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
79a403e8
Commit
79a403e8
authored
Jan 26, 2016
by
Nico Schallehn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
73cb8066
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
5 deletions
+19
-5
media.class.php
media.class.php
+19
-5
No files found.
media.class.php
View file @
79a403e8
...
@@ -23,6 +23,10 @@ class Media {
...
@@ -23,6 +23,10 @@ class Media {
echo
" Zum Anlegen der config bitte config save eingeben!"
.
PHP_EOL
.
PHP_EOL
;
echo
" Zum Anlegen der config bitte config save eingeben!"
.
PHP_EOL
.
PHP_EOL
;
$this
->
config
=
array
(
"configChangeTime"
=>
time
(),
$this
->
config
=
array
(
"configChangeTime"
=>
time
(),
"ReadFromDir"
=>
"/media/QNAP/FilmeWirdgelesen"
,
"ReadFromDir"
=>
"/media/QNAP/FilmeWirdgelesen"
,
"DB_Database"
=>
"MediaDB_nico"
,
"DB_Username"
=>
"MediaDB"
,
"DB_Passwort"
=>
"MediaDB"
,
"DB_Server"
=>
"192.168.0.32"
,
"FolderIgnor"
=>
array
(
'.'
,
'..'
,
'.@__thumb'
,
'@Recycle'
),
"FolderIgnor"
=>
array
(
'.'
,
'..'
,
'.@__thumb'
,
'@Recycle'
),
"HDD"
=>
array
(
1
=>
array
(
"HDDdir"
=>
"/media/QNAP/"
,
"HDD"
=>
array
(
1
=>
array
(
"HDDdir"
=>
"/media/QNAP/"
,
"Filme"
=>
"Filme/"
,
"Filme"
=>
"Filme/"
,
...
@@ -150,7 +154,7 @@ class Media {
...
@@ -150,7 +154,7 @@ class Media {
$array
[
"year"
]
=
$imdb
->
getYear
();
$array
[
"year"
]
=
$imdb
->
getYear
();
$array
[
"size"
]
=
$this
->
getfileSize
(
$Pfad
.
$FilenameOrg
);
$array
[
"size"
]
=
$this
->
getfileSize
(
$Pfad
.
$FilenameOrg
);
//$array["md5"] = md5_file($Pfad.$FilenameOrg); //TODO Einkommentieren für md5
//$array["md5"] = md5_file($Pfad.$FilenameOrg); //TODO Einkommentieren für md5
$array
[
"md5"
]
=
md5_file
(
"/tmp/"
.
$array
[
"imdbID"
]
.
".xml"
);
$array
[
"rating"
]
=
$imdb
->
getRating
();
$array
[
"rating"
]
=
$imdb
->
getRating
();
}
else
{
}
else
{
echo
"nichts gefunden!"
.
PHP_EOL
;
echo
"nichts gefunden!"
.
PHP_EOL
;
...
@@ -201,19 +205,29 @@ class Media {
...
@@ -201,19 +205,29 @@ class Media {
}
}
}
}
foreach
(
$array
as
$key
=>
$value
)
{
return
$this
->
addMovie
(
$array
);
/*foreach ($array as $key => $value) {
echo " ".$key." => '".$value."'".PHP_EOL;
echo " ".$key." => '".$value."'".PHP_EOL;
}
}
*/
}
else
{
}
else
{
return
"Keine Datei!"
.
PHP_EOL
;
return
"Keine Datei!"
.
PHP_EOL
;
}
}
}
}
private
function
addMovie
(
$DataArr
){
$mysqli
=
new
mysqli
(
$this
->
config
[
"DB_Server"
],
$this
->
config
[
"DB_Username"
],
$this
->
config
[
"DB_Passwort"
],
$this
->
config
[
"DB_Database"
]);
if
(
$mysqli
->
error
!=
""
){
return
"Mysql-Fehler: "
.
$mysqli
->
error
.
PHP_EOL
;}
//$ret->num_rows
foreach
(
$DataArr
as
$key
=>
$value
)
{
echo
" "
.
$key
.
" => '"
.
$value
.
"'"
.
PHP_EOL
;
}
$mysqli
->
close
();
}
private
function
getRunTime
(
$laufzeit
){
private
function
getRunTime
(
$laufzeit
){
$string
=
explode
(
" "
,
$laufzeit
);
$string
=
explode
(
" "
,
$laufzeit
);
return
((
trim
(
str_replace
(
"h"
,
""
,
$string
[
0
]))
*
3600
)
+
(
trim
(
str_replace
(
"m"
,
""
,
$string
[
1
])
*
60
)));
return
((
trim
(
str_replace
(
"h"
,
""
,
$string
[
0
]))
*
3600
)
+
(
trim
(
str_replace
(
"m"
,
""
,
$string
[
1
])
*
60
)));
}
}
private
function
getfileSize
(
$file
){
private
function
getfileSize
(
$file
){
//$size = ;
return
trim
(
explode
(
"/"
,
exec
(
'du -b "'
.
$file
.
'"'
))[
0
]);
return
trim
(
explode
(
"/"
,
exec
(
'du -b "'
.
$file
.
'"'
))[
0
]);
}
}
...
...
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