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
30e37954
Commit
30e37954
authored
Mar 10, 2016
by
Nico Schallehn
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git@git.ivaya.de:BA_SI-Projekt/MediaDBPythonScripte.git
parents
01f3e783
a386f55d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
17 deletions
+20
-17
media.class.php
media.class.php
+20
-17
No files found.
media.class.php
View file @
30e37954
...
@@ -161,15 +161,15 @@ class Media {
...
@@ -161,15 +161,15 @@ class Media {
$copy
=
'mv "'
.
$copy
=
'mv "'
.
$Pfad
.
$FilenameOrg
.
'" "'
.
$Pfad
.
$FilenameOrg
.
'" "'
.
$this
->
PfadzumAusgeben
.
(
$array
[
"3d"
]
==
""
?
$this
->
config
[
"HDD"
][
$this
->
HDDID
][
"Filme"
]
:
$this
->
config
[
"HDD"
][
$this
->
HDDID
][
"3D"
])
.
$PfadOrg
.
$array
[
"name"
]
.
" ("
.
$array
[
"resolution"
]
.
")"
.
(
$array
[
"3d"
]
!=
""
?
" (3D)"
:
""
)
.
" ("
.
$array
[
"imdbID"
]
.
")."
.
$Endung
.
'"'
;
$this
->
PfadzumAusgeben
.
(
$array
[
"3d"
]
==
""
?
$this
->
config
[
"HDD"
][
$this
->
HDDID
][
"Filme"
]
:
$this
->
config
[
"HDD"
][
$this
->
HDDID
][
"3D"
])
.
$PfadOrg
.
$array
[
"name"
]
.
" ("
.
$array
[
"resolution"
]
.
")"
.
(
$array
[
"3d"
]
!=
""
?
" (3D)"
:
""
)
.
" ("
.
$array
[
"imdbID"
]
.
")."
.
$Endung
.
'"'
;
file_put_contents
(
"./phpTestout/"
.
$array
[
'imdbID'
]
.
".txt"
,
$copy
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/
imdbID/
"
.
$array
[
'imdbID'
]
.
".txt"
,
$copy
.
PHP_EOL
,
FILE_APPEND
);
shell_exec
(
$copy
);
shell_exec
(
$copy
);
echo
"done!"
.
PHP_EOL
;
echo
"done!"
.
PHP_EOL
;
}
}
shell_exec
(
"mv './phpTestout/
"
.
$array
[
"imdbID"
]
.
".txt' './phpTestout
/OK_"
.
$array
[
"imdbID"
]
.
".txt'"
);
shell_exec
(
"mv './phpTestout/
imdbID/"
.
$array
[
"imdbID"
]
.
".txt' './phpTestout/imdbID
/OK_"
.
$array
[
"imdbID"
]
.
".txt'"
);
}
}
else
{
else
{
echo
$this
->
Console
->
error
(
"Fehler beim Eintragen in die DB!"
)
.
PHP_EOL
;
echo
$this
->
Console
->
error
(
"Fehler beim Eintragen in die DB!"
)
.
PHP_EOL
;
file_put_contents
(
"./phpTestout/"
.
$array
[
"imdbID"
]
.
".txt"
,
"Fehler beim Eintragen in die DB"
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/
imdbID/
"
.
$array
[
"imdbID"
]
.
".txt"
,
"Fehler beim Eintragen in die DB"
.
PHP_EOL
,
FILE_APPEND
);
}
}
}
else
if
(
$action
==
"check"
){
}
else
if
(
$action
==
"check"
){
if
(
$this
->
updateMovie
(
$array
,
$Pfad
.
$FilenameOrg
,
false
,
true
)){
//TODO auf true für md5!!!
if
(
$this
->
updateMovie
(
$array
,
$Pfad
.
$FilenameOrg
,
false
,
true
)){
//TODO auf true für md5!!!
...
@@ -403,6 +403,9 @@ class Media {
...
@@ -403,6 +403,9 @@ class Media {
if
(
!
(
strpos
(
$value
,
"as"
)
==
false
)){
if
(
!
(
strpos
(
$value
,
"as"
)
==
false
)){
$value
=
explode
(
"as"
,
$value
);
$value
=
explode
(
"as"
,
$value
);
$value
[
1
]
=
str_replace
(
"(uncredited)"
,
""
,
$value
[
1
]);
$value
[
1
]
=
str_replace
(
"(uncredited)"
,
""
,
$value
[
1
]);
if
(
substr
(
$value
[
1
],
-
1
)
==
"("
){
$value
[
1
]
=
substr
(
$value
[
1
],
0
,
-
1
);
}
//$value[1] = str_replace("(voice)", "", $value[1]);
//$value[1] = str_replace("(voice)", "", $value[1]);
//$value[1] = str_replace("(voice)", "", $value[1]);
//$value[1] = str_replace("(voice)", "", $value[1]);
...
@@ -434,12 +437,12 @@ class Media {
...
@@ -434,12 +437,12 @@ class Media {
unset
(
$array
[
"fsk"
]);
unset
(
$array
[
"fsk"
]);
}
}
if
(
!
$this
->
gibTMDBdata
(
$array
[
"imdbID"
],
$array
)){
if
(
!
$this
->
gibTMDBdata
(
$array
[
"imdbID"
],
$array
)){
file_put_contents
(
"./phpTestout/"
.
$array
[
"imdbID"
]
.
".txt"
,
"Keine Infos auf TMDB gefunden: "
.
$Pfad
.
$FilenameOrg
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/
imdbID/
"
.
$array
[
"imdbID"
]
.
".txt"
,
"Keine Infos auf TMDB gefunden: "
.
$Pfad
.
$FilenameOrg
.
PHP_EOL
,
FILE_APPEND
);
return
false
;
//TODO Abbruch wenn keine Daten auf TMDB gefunden
return
false
;
//TODO Abbruch wenn keine Daten auf TMDB gefunden
}
}
}
else
{
}
else
{
echo
$this
->
Console
->
error
(
"imdbID ("
.
$array
[
"imdbID"
]
.
") nicht bei imdb gefunden!"
)
.
PHP_EOL
;
echo
$this
->
Console
->
error
(
"imdbID ("
.
$array
[
"imdbID"
]
.
") nicht bei imdb gefunden!"
)
.
PHP_EOL
;
file_put_contents
(
"./phpTestout/"
.
$array
[
"imdbID"
]
.
".txt"
,
"Keine Infos auf imdbID gefunden: "
.
$Pfad
.
$FilenameOrg
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/
imdbID/
"
.
$array
[
"imdbID"
]
.
".txt"
,
"Keine Infos auf imdbID gefunden: "
.
$Pfad
.
$FilenameOrg
.
PHP_EOL
,
FILE_APPEND
);
return
false
;
return
false
;
}
}
}
}
...
@@ -478,7 +481,7 @@ class Media {
...
@@ -478,7 +481,7 @@ class Media {
$array
[
"channelsger"
]
=
substr
(
$array
[
"channelsger"
],
strripos
(
$array
[
"channelsger"
],
"/"
)
+
1
);
$array
[
"channelsger"
]
=
substr
(
$array
[
"channelsger"
],
strripos
(
$array
[
"channelsger"
],
"/"
)
+
1
);
if
(
!
is_numeric
(
$array
[
"channelsger"
])){
if
(
!
is_numeric
(
$array
[
"channelsger"
])){
echo
$this
->
Console
->
error
(
"channelsger ist nicht Numerisch!"
)
.
PHP_EOL
;
echo
$this
->
Console
->
error
(
"channelsger ist nicht Numerisch!"
)
.
PHP_EOL
;
file_put_contents
(
"./phpTestout/"
.
$array
[
"imdbID"
]
.
".txt"
,
"channelsger ist nicht Numerisch!"
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/
imdbID/
"
.
$array
[
"imdbID"
]
.
".txt"
,
"channelsger ist nicht Numerisch!"
.
PHP_EOL
,
FILE_APPEND
);
return
false
;
return
false
;
}
}
}
}
...
@@ -491,7 +494,7 @@ class Media {
...
@@ -491,7 +494,7 @@ class Media {
$array
[
"channelseng"
]
=
substr
(
$array
[
"channelseng"
],
strripos
(
$array
[
"channelseng"
],
"/"
)
+
1
);
$array
[
"channelseng"
]
=
substr
(
$array
[
"channelseng"
],
strripos
(
$array
[
"channelseng"
],
"/"
)
+
1
);
if
(
!
is_numeric
(
$array
[
"channelseng"
])){
if
(
!
is_numeric
(
$array
[
"channelseng"
])){
echo
$this
->
Console
->
error
(
"channelseng ist nicht Numerisch!"
)
.
PHP_EOL
;
echo
$this
->
Console
->
error
(
"channelseng ist nicht Numerisch!"
)
.
PHP_EOL
;
file_put_contents
(
"./phpTestout/"
.
$array
[
"imdbID"
]
.
".txt"
,
"channelseng ist nicht Numerisch!"
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/
imdbID/
"
.
$array
[
"imdbID"
]
.
".txt"
,
"channelseng ist nicht Numerisch!"
.
PHP_EOL
,
FILE_APPEND
);
return
false
;
return
false
;
}
}
}
}
...
@@ -623,7 +626,7 @@ class Media {
...
@@ -623,7 +626,7 @@ class Media {
//var_dump($DataArr);
//var_dump($DataArr);
echo
" Berechne MD5... "
;
echo
" Berechne MD5... "
;
$DataArr
[
"md5"
]
=
substr
(
shell_exec
(
'md5sum -b "'
.
$File
.
'"'
),
0
,
32
);
$DataArr
[
"md5"
]
=
substr
(
shell_exec
(
'md5sum -b "'
.
$File
.
'"'
),
0
,
32
);
file_put_contents
(
"./phpTestout/"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
"md5 = "
.
$DataArr
[
"md5"
]
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/
imdbID/
"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
"md5 = "
.
$DataArr
[
"md5"
]
.
PHP_EOL
,
FILE_APPEND
);
$DataArr
[
"lastUpdate"
]
=
date
(
"Y-m-d"
);
$DataArr
[
"lastUpdate"
]
=
date
(
"Y-m-d"
);
echo
" done!"
.
PHP_EOL
;
echo
" done!"
.
PHP_EOL
;
}
}
...
@@ -687,13 +690,13 @@ class Media {
...
@@ -687,13 +690,13 @@ class Media {
echo
$Ausgabe
;
echo
$Ausgabe
;
//echo $SQL.PHP_EOL;
//echo $SQL.PHP_EOL;
$mysqli
->
query
(
$SQL
);
$mysqli
->
query
(
$SQL
);
file_put_contents
(
"./phpTestout/"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
$SQL
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/
imdbID/
"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
$SQL
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/update.txt"
,
$SQL
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/update.txt"
,
$SQL
.
PHP_EOL
,
FILE_APPEND
);
}
else
{
}
else
{
$Ausgabe
=
"Unterschiede (bei "
.
$Film
[
"imdbID"
]
.
") :"
.
PHP_EOL
.
$changed
.
PHP_EOL
;
$Ausgabe
=
"Unterschiede (bei "
.
$Film
[
"imdbID"
]
.
") :"
.
PHP_EOL
.
$changed
.
PHP_EOL
;
echo
$Ausgabe
;
echo
$Ausgabe
;
file_put_contents
(
"./phpTestout/"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
$Ausgabe
.
PHP_EOL
.
$SQL
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/
imdbID/
"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
$Ausgabe
.
PHP_EOL
.
$SQL
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/update_CheckOnly.txt"
,
$Ausgabe
.
" "
.
$SQL
.
PHP_EOL
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/update_CheckOnly.txt"
,
$Ausgabe
.
" "
.
$SQL
.
PHP_EOL
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/update.sql"
,
$SQL
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/update.sql"
,
$SQL
.
PHP_EOL
,
FILE_APPEND
);
}
}
...
@@ -705,7 +708,7 @@ class Media {
...
@@ -705,7 +708,7 @@ class Media {
}
else
{
}
else
{
file_put_contents
(
"./phpTestout/update_CheckOnly.txt"
,
"Alles OK bei Film "
.
$Film
[
"name"
]
.
"("
.
$Film
[
"imdbID"
]
.
")!"
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/update_CheckOnly.txt"
,
"Alles OK bei Film "
.
$Film
[
"name"
]
.
"("
.
$Film
[
"imdbID"
]
.
")!"
.
PHP_EOL
,
FILE_APPEND
);
}
}
file_put_contents
(
"./phpTestout/"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
"Alles OK bei Film "
.
$Film
[
"name"
]
.
"("
.
$Film
[
"imdbID"
]
.
")!"
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/
imdbID/
"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
"Alles OK bei Film "
.
$Film
[
"name"
]
.
"("
.
$Film
[
"imdbID"
]
.
")!"
.
PHP_EOL
,
FILE_APPEND
);
return
false
;
return
false
;
}
}
...
@@ -728,14 +731,14 @@ class Media {
...
@@ -728,14 +731,14 @@ class Media {
if
(
$mysqli
->
error
!=
""
){
echo
"Mysql-Fehler: "
.
$mysqli
->
error
.
PHP_EOL
;
return
false
;}
if
(
$mysqli
->
error
!=
""
){
echo
"Mysql-Fehler: "
.
$mysqli
->
error
.
PHP_EOL
;
return
false
;}
if
(
$result
->
num_rows
>
0
){
if
(
$result
->
num_rows
>
0
){
echo
" Film bereits in DB!"
.
PHP_EOL
;
echo
" Film bereits in DB!"
.
PHP_EOL
;
file_put_contents
(
"./phpTestout/"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
"Film bereits in DB!"
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/
imdbID/
"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
"Film bereits in DB!"
.
PHP_EOL
,
FILE_APPEND
);
return
false
;
return
false
;
}
}
// Jetzt noch MD5 berechnen
// Jetzt noch MD5 berechnen
if
(
$md5
){
if
(
$md5
){
echo
" Berechne MD5... "
;
echo
" Berechne MD5... "
;
$DataArr
[
"md5"
]
=
substr
(
shell_exec
(
'md5sum -b "'
.
$File
.
'"'
),
0
,
32
);
$DataArr
[
"md5"
]
=
substr
(
shell_exec
(
'md5sum -b "'
.
$File
.
'"'
),
0
,
32
);
file_put_contents
(
"./phpTestout/"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
"md5 = "
.
$DataArr
[
"md5"
]
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/
imdbID/
"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
"md5 = "
.
$DataArr
[
"md5"
]
.
PHP_EOL
,
FILE_APPEND
);
$DataArr
[
"lastUpdate"
]
=
date
(
"Y-m-d"
);
$DataArr
[
"lastUpdate"
]
=
date
(
"Y-m-d"
);
echo
" done!"
.
PHP_EOL
;
echo
" done!"
.
PHP_EOL
;
}
}
...
@@ -779,10 +782,10 @@ class Media {
...
@@ -779,10 +782,10 @@ class Media {
$Query
=
"INSERT INTO Filme ("
.
implode
(
","
,
$keys
)
.
") VALUES ("
.
implode
(
","
,
$values
)
.
");"
;
$Query
=
"INSERT INTO Filme ("
.
implode
(
","
,
$keys
)
.
") VALUES ("
.
implode
(
","
,
$values
)
.
");"
;
$result
=
$mysqli
->
query
(
$Query
);
$result
=
$mysqli
->
query
(
$Query
);
file_put_contents
(
"./phpTestout/"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
$Query
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/
imdbID/
"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
$Query
.
PHP_EOL
,
FILE_APPEND
);
if
(
$mysqli
->
error
!=
""
){
if
(
$mysqli
->
error
!=
""
){
echo
"Mysql-Fehler: "
.
$mysqli
->
error
.
PHP_EOL
;
echo
"Mysql-Fehler: "
.
$mysqli
->
error
.
PHP_EOL
;
file_put_contents
(
"./phpTestout/"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
"Mysql-Fehler: "
.
$mysqli
->
error
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/
imdbID/
"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
"Mysql-Fehler: "
.
$mysqli
->
error
.
PHP_EOL
,
FILE_APPEND
);
return
false
;
return
false
;
}
}
echo
"done"
.
PHP_EOL
;
echo
"done"
.
PHP_EOL
;
...
@@ -793,10 +796,10 @@ class Media {
...
@@ -793,10 +796,10 @@ class Media {
//echo $this->Console->getColoredString("Query", "light_gray", "green")." ".$Query.PHP_EOL;
//echo $this->Console->getColoredString("Query", "light_gray", "green")." ".$Query.PHP_EOL;
$result
=
$mysqli
->
query
(
$Query
);
$result
=
$mysqli
->
query
(
$Query
);
file_put_contents
(
"./phpTestout/"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
$Query
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/
imdbID/
"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
$Query
.
PHP_EOL
,
FILE_APPEND
);
if
(
$mysqli
->
error
!=
""
){
if
(
$mysqli
->
error
!=
""
){
echo
"Mysql-Fehler: "
.
$mysqli
->
error
.
PHP_EOL
;
echo
"Mysql-Fehler: "
.
$mysqli
->
error
.
PHP_EOL
;
file_put_contents
(
"./phpTestout/"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
"Mysql-Fehler: "
.
$mysqli
->
error
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
"./phpTestout/
imdbID/
"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
"Mysql-Fehler: "
.
$mysqli
->
error
.
PHP_EOL
,
FILE_APPEND
);
return
false
;
return
false
;
}
}
...
...
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