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
Honeypot
mopidy-youtube
Commits
8d3c65bc
Commit
8d3c65bc
authored
May 28, 2014
by
dz0ny
Browse files
Fix: parsing title
parent
f4c95420
Changes
2
Hide whitespace changes
Inline
Side-by-side
mopidy_youtube/__init__.py
View file @
8d3c65bc
...
...
@@ -6,7 +6,7 @@ import os
from
mopidy
import
config
,
ext
__version__
=
'0.1
.0
'
__version__
=
'
1.
0.1'
logger
=
logging
.
getLogger
(
__name__
)
...
...
mopidy_youtube/backend.py
View file @
8d3c65bc
...
...
@@ -5,7 +5,7 @@ import re
import
string
from
urlparse
import
urlparse
,
parse_qs
from
mopidy
import
backend
from
mopidy.models
import
SearchResult
,
Track
,
Album
from
mopidy.models
import
SearchResult
,
Track
,
Album
,
Artist
import
pykka
import
pafy
import
requests
...
...
@@ -50,16 +50,33 @@ def resolve_url(url, stream=False):
logger
.
debug
(
'%s - %s %s %s'
%
(
video
.
title
,
uri
.
bitrate
,
uri
.
mediatype
,
uri
.
extension
))
uri
=
uri
.
url
track
=
Track
(
name
=
video
.
title
,
comment
=
video
.
videoid
,
length
=
video
.
length
*
1000
,
album
=
Album
(
name
=
'Youtube'
,
images
=
[
video
.
bigthumb
,
video
.
bigthumbhd
]
),
uri
=
uri
)
if
not
uri
:
return
if
'-'
in
video
.
title
:
title
=
video
.
title
.
split
(
'-'
)
track
=
Track
(
name
=
title
[
1
].
strip
(),
comment
=
video
.
videoid
,
length
=
video
.
length
*
1000
,
artists
=
[
Artist
(
name
=
title
[
0
].
strip
())],
album
=
Album
(
name
=
'Youtube'
,
images
=
[
video
.
bigthumb
,
video
.
bigthumbhd
]
),
uri
=
uri
)
else
:
track
=
Track
(
name
=
video
.
title
,
comment
=
video
.
videoid
,
length
=
video
.
length
*
1000
,
album
=
Album
(
name
=
'Youtube'
,
images
=
[
video
.
bigthumb
,
video
.
bigthumbhd
]
),
uri
=
uri
)
return
track
...
...
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