Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MediaDBPythonScripte
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
8
Issues
8
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BA_SI-Projekt
MediaDBPythonScripte
Commits
955847d5
Commit
955847d5
authored
Feb 24, 2016
by
Nico Schallehn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erster Testlauf mit nfo Dateien
parent
295402cd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
3 deletions
+41
-3
media.class.php
media.class.php
+41
-3
No files found.
media.class.php
View file @
955847d5
...
@@ -30,7 +30,8 @@ class Media {
...
@@ -30,7 +30,8 @@ class Media {
"DB_Passwort"
=>
"MediaDB"
,
"DB_Passwort"
=>
"MediaDB"
,
"DB_Server"
=>
"192.168.0.32"
,
"DB_Server"
=>
"192.168.0.32"
,
"ApiKeys"
=>
array
(
"Fanart_Key"
=>
"9902c9197f457401ff7a7eba839213ba"
,
"ApiKeys"
=>
array
(
"Fanart_Key"
=>
"9902c9197f457401ff7a7eba839213ba"
,
"Tmdb_Key"
=>
"b1ddcc7d16281ce09f692896f882ba9d"
),
"Tmdb_Key"
=>
"b1ddcc7d16281ce09f692896f882ba9d"
,
"MediaDB_Key"
=>
"Wah2doonie"
),
"FolderIgnor"
=>
array
(
'.'
,
'..'
,
'.@__thumb'
,
'@Recycle'
),
"FolderIgnor"
=>
array
(
'.'
,
'..'
,
'.@__thumb'
,
'@Recycle'
),
"FileEndungIgnor"
=>
array
(
'jpg'
,
'nfo'
),
"FileEndungIgnor"
=>
array
(
'jpg'
,
'nfo'
),
"HDD"
=>
array
(
1
=>
array
(
"HDDdir"
=>
"/media/QNAP/"
,
"HDD"
=>
array
(
1
=>
array
(
"HDDdir"
=>
"/media/QNAP/"
,
...
@@ -521,7 +522,7 @@ class Media {
...
@@ -521,7 +522,7 @@ class Media {
}
}
private
function
GenerateNFO
(
$DataArr
,
$File
){
private
function
GenerateNFO
(
$DataArr
,
$File
){
$nfoFile
=
substr
(
$File
,
0
,
strripos
(
$File
,
"."
))
.
".nfo"
;
// Echte NFO Ausgabe Pfad
$nfoFile
=
substr
(
$File
,
0
,
strripos
(
$File
,
"."
))
.
".nfo"
;
// Echte NFO Ausgabe Pfad
$mediaDB
=
$this
->
jsonCacheDecoder
(
"http://mediadb.ivaya.de/api.php?key="
.
$this
->
config
[
"ApiKeys"
][
'Fanart_Key'
]
.
"&action=GetDataList&Tabelle=Filme&Spalten=imdbID,name,views,lastView,Genre,Schauspieler&imdbID="
.
$DataArr
[
"imdbID"
]);
$nfoFile
=
str_replace
(
"/media/QNAP/Filme"
,
"phpTestout"
,
$nfoFile
);
// nur für Testausgaben drin....
$nfoFile
=
str_replace
(
"/media/QNAP/Filme"
,
"phpTestout"
,
$nfoFile
);
// nur für Testausgaben drin....
$co
=
'<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>'
.
PHP_EOL
;
$co
=
'<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>'
.
PHP_EOL
;
$co
.=
'<movie>'
.
PHP_EOL
;
$co
.=
'<movie>'
.
PHP_EOL
;
...
@@ -529,6 +530,43 @@ class Media {
...
@@ -529,6 +530,43 @@ class Media {
$co
.=
' <rating>'
.
$DataArr
[
'rating'
]
.
'</rating>'
.
PHP_EOL
;
$co
.=
' <rating>'
.
$DataArr
[
'rating'
]
.
'</rating>'
.
PHP_EOL
;
$co
.=
' <year>'
.
$DataArr
[
'year'
]
.
'</year>'
.
PHP_EOL
;
$co
.=
' <year>'
.
$DataArr
[
'year'
]
.
'</year>'
.
PHP_EOL
;
$co
.=
' <plot>'
.
$DataArr
[
'summary'
]
.
'</plot>'
.
PHP_EOL
;
$co
.=
' <plot>'
.
$DataArr
[
'summary'
]
.
'</plot>'
.
PHP_EOL
;
$co
.=
' <runtime>'
.
(
$DataArr
[
'duration'
]
/
60
)
.
'</runtime>'
.
PHP_EOL
;
if
(
file_exists
(
$this
->
config
[
"CoverDir"
]
.
"Filme/full/"
.
$DataArr
[
"imdbID"
]
.
".jpg"
)){
$co
.=
' <thumb aspect="poster" preview="http://mediadb.ivaya.de/cover/Filme/high/'
.
$DataArr
[
'imdbID'
]
.
'.jpg">'
.
'http://mediadb.ivaya.de/cover/Filme/high/'
.
$DataArr
[
'imdbID'
]
.
'.jpg</thumb>'
.
PHP_EOL
;
}
if
(
file_exists
(
$this
->
config
[
"CoverDir"
]
.
"Filme/background/"
.
$DataArr
[
"imdbID"
]
.
".jpg"
)){
$co
.=
'<fanart>'
.
PHP_EOL
;
$co
.=
' <thumb preview="http://mediadb.ivaya.de/cover/Filme/background/'
.
$DataArr
[
'imdbID'
]
.
'.jpg">'
.
'http://mediadb.ivaya.de/cover/Filme/background/'
.
$DataArr
[
'imdbID'
]
.
'.jpg</thumb>'
.
PHP_EOL
;
$co
.=
'</fanart>'
.
PHP_EOL
;
}
$co
.=
' <mpaa>FSK '
.
$DataArr
[
'fsk'
]
.
'</mpaa>'
.
PHP_EOL
;
$co
.=
' <playcount>'
.
$mediaDB
[
'Antwort'
][
'Data'
][
0
][
'views'
]
.
'</playcount>'
.
PHP_EOL
;
$co
.=
' <lastplayed>'
.
$mediaDB
[
'Antwort'
][
'Data'
][
0
][
'lastView'
]
.
'</lastplayed>'
.
PHP_EOL
;
$co
.=
' <id>tt'
.
$DataArr
[
'imdbID'
]
.
'</id>'
.
PHP_EOL
;
foreach
(
$mediaDB
[
'Antwort'
][
'Data'
][
0
][
'Genre'
]
as
$value
)
{
$co
.=
' <genre>'
.
$value
.
'</genre>'
.
PHP_EOL
;
}
// <set> **** Filmreihe
if
(
isset
(
$DataArr
[
'youtube'
])){
$youtube
=
explode
(
":"
,
$DataArr
[
'youtube'
]);
$co
.=
' <trailer>plugin://plugin.video.youtube/?action=play_video&videoid='
.
$youtube
[
1
]
.
'</trailer>'
.
PHP_EOL
;
}
// <fileinfo> .....
$counter
=
0
;
foreach
(
$mediaDB
[
'Antwort'
][
'Data'
][
0
][
'Schauspieler'
]
as
$value
)
{
$co
.=
' <actor>'
.
PHP_EOL
;
$co
.=
' <name>'
.
$value
.
'</name>'
.
PHP_EOL
;
$co
.=
' <order>'
.
$counter
.
'</order>'
.
PHP_EOL
;
$co
.=
' </actor>'
.
PHP_EOL
;
$counter
++
;
}
$co
.=
' <dateadded>'
.
$mediaDB
[
'Antwort'
][
'Data'
][
0
][
'added'
]
.
'</dateadded>'
.
PHP_EOL
;
$co
.=
'</movie>'
.
PHP_EOL
;
$co
.=
'</movie>'
.
PHP_EOL
;
if
(
!
$handle
=
fopen
(
$nfoFile
,
"'w+"
))
{
if
(
!
$handle
=
fopen
(
$nfoFile
,
"'w+"
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment