mirror of
https://github.com/nims11/IPod-Shuffle-4g.git
synced 2025-12-07 16:08:00 +09:00
use set_podcast method to dedup podcast feature setting
This commit is contained in:
parent
3ca83b6273
commit
0b277a967c
1 changed files with 9 additions and 12 deletions
|
|
@ -384,20 +384,19 @@ class Track(Record):
|
||||||
("unknown5", ("32s", b"\x00" * 32)),
|
("unknown5", ("32s", b"\x00" * 32)),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
def set_podcast(self):
|
||||||
|
self.is_podcast = True
|
||||||
|
self["dontskip"] = 0 # podcasts should not be "not skipped" when shuffling (re: should not be shuffled)
|
||||||
|
self["remember"] = 1 # podcasts should remember their last playback position
|
||||||
|
|
||||||
def populate(self, filename):
|
def populate(self, filename):
|
||||||
self["filename"] = self.path_to_ipod(filename).encode('utf-8')
|
self["filename"] = self.path_to_ipod(filename).encode('utf-8')
|
||||||
|
|
||||||
# assign the "filetype" based on the extension
|
if os.path.splitext(filename)[1].lower() in (".m4a", ".m4b", ".m4p", ".aa"):
|
||||||
ext = os.path.splitext(filename)[1].lower()
|
self["filetype"] = 2
|
||||||
for type in FileType:
|
|
||||||
if ext in type.extensions:
|
|
||||||
self.filetype = type.filetype
|
|
||||||
break
|
|
||||||
|
|
||||||
if "/iPod_Control/Podcasts/" in filename:
|
if "/iPod_Control/Podcasts/" in filename:
|
||||||
self.is_podcast = True
|
self.set_podcast()
|
||||||
self["dontskip"] = 0 # podcasts should not be "not skipped" (re: should be skipped) when shuffling
|
|
||||||
self["remember"] = 1 # podcasts should remember their last playback position
|
|
||||||
|
|
||||||
text = os.path.splitext(os.path.basename(filename))[0]
|
text = os.path.splitext(os.path.basename(filename))[0]
|
||||||
|
|
||||||
|
|
@ -410,9 +409,7 @@ class Track(Record):
|
||||||
print("Error calling mutagen. Possible invalid filename/ID3Tags (hyphen in filename?)")
|
print("Error calling mutagen. Possible invalid filename/ID3Tags (hyphen in filename?)")
|
||||||
if audio:
|
if audio:
|
||||||
if "Podcast" in audio.get("genre", ["Unknown"]):
|
if "Podcast" in audio.get("genre", ["Unknown"]):
|
||||||
self.is_podcast = True
|
self.set_podcast()
|
||||||
self["dontskip"] = 0
|
|
||||||
self["remember"] = 1
|
|
||||||
|
|
||||||
# Note: Rythmbox IPod plugin sets this value always 0.
|
# Note: Rythmbox IPod plugin sets this value always 0.
|
||||||
self["stop_at_pos_ms"] = int(audio.info.length * 1000)
|
self["stop_at_pos_ms"] = int(audio.info.length * 1000)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue