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
bf4144bb
Commit
bf4144bb
authored
Feb 25, 2016
by
Nico Schallehn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eingebaut, das Update nur gemacht wird wenn letztes Update Länger als 7
Tage zurück liegt!
parent
780ff8ea
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
15 deletions
+20
-15
media.class.php
media.class.php
+20
-15
No files found.
media.class.php
View file @
bf4144bb
...
...
@@ -161,8 +161,8 @@ class Media {
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
);
}
}
else
if
(
$action
==
"
update
"
){
if
(
$this
->
updateMovie
(
$array
,
$Pfad
.
$FilenameOrg
,
false
,
fals
e
)){
//TODO auf true für md5!!!
}
else
if
(
$action
==
"
check
"
){
if
(
$this
->
updateMovie
(
$array
,
$Pfad
.
$FilenameOrg
,
false
,
tru
e
)){
//TODO auf true für md5!!!
echo
" Film wurde Aktualisiert"
.
PHP_EOL
;
}
else
{
echo
" Film wurde nicht Aktualisiert"
.
PHP_EOL
;
...
...
@@ -170,10 +170,11 @@ class Media {
//NFO
$this
->
GenerateNFO
(
$array
,
$Pfad
.
$FilenameOrg
);
//TODO auf true für md5!!!
}
else
if
(
$action
==
"check"
){
}
else
if
(
$action
==
"check
md5
"
){
if
(
$this
->
updateMovie
(
$array
,
$Pfad
.
$FilenameOrg
,
true
,
true
)){
echo
"Film wurde geprüft"
.
PHP_EOL
;
echo
"Film wurde geprüft und Query angelegt"
.
PHP_EOL
;
}
else
{
echo
"Film wurde geprüft, keine Änderung"
.
PHP_EOL
;
}
}
}
...
...
@@ -503,24 +504,28 @@ class Media {
echo
" Fertig, in Datei
$nfoFile
wurde geschrieben"
.
PHP_EOL
;
}
private
function
updateMovie
(
$DataArr
,
$File
,
$md5
=
true
,
$CheckOnly
=
true
){
// Jetzt noch MD5 berechnen
if
(
$md5
){
echo
" Berechne MD5... "
;
$DataArr
[
"md5"
]
=
substr
(
shell_exec
(
'md5sum -b "'
.
$File
.
'"'
),
0
,
32
);
file_put_contents
(
"./phpTestout/"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
"md5 = "
.
$DataArr
[
"md5"
]
.
PHP_EOL
,
FILE_APPEND
);
echo
" done!"
.
PHP_EOL
;
}
$mysqli
=
new
mysqli
(
$this
->
config
[
"DB_Server"
],
$this
->
config
[
"DB_Username"
],
$this
->
config
[
"DB_Passwort"
],
$this
->
config
[
"DB_Database"
]);
if
(
$mysqli
->
connect_error
!=
""
){
echo
"Mysql-Fehler: "
.
$mysqli
->
connect_error
.
PHP_EOL
;
return
false
;}
$mysqli
->
query
(
"SET NAMES 'utf8'"
);
$Query
=
"SELECT * FROM Filme WHERE imdbID = '"
.
$DataArr
[
'imdbID'
]
.
"' AND 3d "
.
(
!
(
$DataArr
[
'3d'
]
==
""
)
?
"!="
:
"="
)
.
'""'
;
//echo $Query;
$result
=
$mysqli
->
query
(
$Query
);
if
(
$mysqli
->
error
!=
""
){
echo
"Mysql-Fehler: "
.
$mysqli
->
error
.
PHP_EOL
;
return
false
;}
if
(
$result
->
num_rows
==
1
){
$Film
=
$result
->
fetch_assoc
();
if
(
strtotime
(
$Film
[
"lastUpdate"
])
<=
time
()
-
(
7
*
24
*
60
*
60
)){
echo
"Film wurde innerhalb der jetzten 7 Tage Aktualisiert!"
.
PHP_EOL
;
return
false
;
}
// Jetzt noch MD5 berechnen
if
(
$md5
){
echo
" Berechne MD5... "
;
$DataArr
[
"md5"
]
=
substr
(
shell_exec
(
'md5sum -b "'
.
$File
.
'"'
),
0
,
32
);
file_put_contents
(
"./phpTestout/"
.
$DataArr
[
'imdbID'
]
.
".txt"
,
"md5 = "
.
$DataArr
[
"md5"
]
.
PHP_EOL
,
FILE_APPEND
);
echo
" done!"
.
PHP_EOL
;
}
$changed
=
""
;
$first
=
true
;
...
...
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