Skip to content

Commit

Permalink
[#1] skip songs without a location
Browse files Browse the repository at this point in the history
  • Loading branch information
phauer committed Sep 28, 2016
1 parent b8a85e5 commit f0138fd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- add tests for remote songs
- extend pyItunes: Add to Song: Track Type ("File" vs "Remote"). optionally Purchased (None vs True) and Matched (None vs True)
2 changes: 1 addition & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
default_task = ['install_dependencies', 'clean', 'publish']

name = "migrate-itunes-to-rhythmbox"
version = "1.0.0"
version = "1.0.1"
summary = settings.PROJECT_DESCRIPTION
authors = (Author("Philipp Hauer", "")),
url = "https://github.com/phauer/migrate-itunes-to-rhythmbox"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from lxml import etree
from pyItunes import Playlist
from pyItunes import Playlist, Song
from typing import List, Dict
from path import Path
from migrate_itunes_to_rhythmbox.transform import transform_to_rhythmbox_path
Expand Down Expand Up @@ -31,10 +31,13 @@ def write(playlists: List[Playlist], target_path: Path, target_library_root: str
'search-type': "search-match", 'type': "static"}
playlist_element = etree.SubElement(root, "playlist", attributes)
for song in playlist.tracks:
transformed_location = transform_to_rhythmbox_path(song.location_escaped, target_library_root, source_library_root)
# transformed_location = transform_to_rhythmbox_path(song.location, target_library_root, source_library_root)
location_element = etree.SubElement(playlist_element, "location")
location_element.text = transformed_location
if song.location_escaped is not None:
transformed_location = transform_to_rhythmbox_path(song.location_escaped, target_library_root, source_library_root)
location_element = etree.SubElement(playlist_element, "location")
location_element.text = transformed_location
else:
print(" Can't convert the track [{} - {}] in playlist '{}' because there is no file location defined. It's probably a remote file."
.format(song.artist, song.name, playlist.name))
common.write_to_file(root, target_path, add_standalone_to_xml_declaration=False)


Expand Down

0 comments on commit f0138fd

Please sign in to comment.