Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gerion Entrup
brainzfs
Commits
fca22b6b
Commit
fca22b6b
authored
Aug 18, 2016
by
Gerion Entrup
Browse files
walker: PEP8
parent
619d0f3d
Changes
1
Hide whitespace changes
Inline
Side-by-side
walker.py
View file @
fca22b6b
...
...
@@ -3,12 +3,10 @@ import mutagen
import
threading
import
logging
from
sqlalchemy.orm
import
Session
from
model
import
Recording
from
utils
import
pairwise
from
collector
import
Paths
class
Walker
(
threading
.
Thread
):
def
__init__
(
self
,
session_fac
,
sourcedir
):
super
().
__init__
(
target
=
self
)
...
...
@@ -31,12 +29,14 @@ class Walker(threading.Thread):
self
.
log
.
info
(
'Unknown file type: {}'
.
format
(
filepath
))
continue
except
Exception
as
err
:
self
.
log
.
error
(
'Unexpected exception: {}, Path: {}'
.
format
(
err
,
filepath
))
self
.
log
.
error
(
'Unexpected exception: {}, Path: {}'
.
format
(
err
,
filepath
))
continue
if
mut
is
not
None
:
mbid
=
self
.
get_mbid
(
mut
)
if
mbid
is
not
None
and
mbid
not
in
self
.
_mbids
:
Paths
.
put
((
mbid
,
os
.
path
.
abspath
(
filepath
)))
Paths
.
put
((
mbid
,
os
.
path
.
abspath
(
filepath
)))
self
.
_mbids
.
add
(
mbid
)
def
get_mbid
(
self
,
mut
):
...
...
@@ -54,6 +54,6 @@ class Walker(threading.Thread):
if
mut
[
key
][
0
].
dataformat
==
mutagen
.
mp4
.
AtomDataType
.
UTF8
:
return
mut
[
key
][
0
].
decode
(
'utf8'
)
else
:
raise
Exception
(
'MP4 could not be parsed correctly. Dataformat is not UTF8'
)
raise
Exception
(
'MP4 could not be parsed correctly. '
+
'Dataformat is not UTF8'
)
return
None
Write
Preview
Supports
Markdown
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