mirror of
https://github.com/nims11/IPod-Shuffle-4g.git
synced 2025-12-07 16:08:00 +09:00
Merge remote-tracking branch 'upstream/master' into NicoHood3
This commit is contained in:
commit
9a8129683a
3 changed files with 26 additions and 10 deletions
|
|
@ -931,4 +931,5 @@ It seems to be ignored when shuffling within a playlist!<br>
|
||||||
A dbid of all zeros yields a voiceover of All songs. Also playlist dbids without a corresponding voiceover file will yield a voiceover of playlist n or audiobook n where n is the playlist number. The shuffle assumes the podcast playlist is last.<br>
|
A dbid of all zeros yields a voiceover of All songs. Also playlist dbids without a corresponding voiceover file will yield a voiceover of playlist n or audiobook n where n is the playlist number. The shuffle assumes the podcast playlist is last.<br>
|
||||||
<br>
|
<br>
|
||||||
The <a class="wiki_link" href="iTunesStats3gen.md">iTunesStats</a> file is also different in the 3gen iPod.
|
The <a class="wiki_link" href="iTunesStats3gen.md">iTunesStats</a> file is also different in the 3gen iPod.
|
||||||
|
<p>Original Source: <a href="http://shuffle3db.wikispaces.com/iTunesSD3gen">http://shuffle3db.wikispaces.com/iTunesSD3gen</a> (expired)</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -108,4 +108,8 @@ Here's the general layout of an iTunesSD file:<br>
|
||||||
</td>
|
</td>
|
||||||
<td><br>
|
<td><br>
|
||||||
</td>
|
</td>
|
||||||
<td><span style="font-family: 'Courier New',Courier,monospace;">00 00 00 00</span>
|
<td><span style="font-family: 'Courier New',Courier,monospace;">00 00 00 00</span><br />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<p>Original Source: <a href="http://shuffle3db.wikispaces.com/iTunesSD3gen">http://shuffle3db.wikispaces.com/iTunesStats3gen</a> (expired)</p>
|
||||||
|
|
|
||||||
29
shuffle.py
29
shuffle.py
|
|
@ -14,6 +14,7 @@ import argparse
|
||||||
import shutil
|
import shutil
|
||||||
import re
|
import re
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import signal
|
||||||
|
|
||||||
audio_ext = (".mp3", ".m4a", ".m4b", ".m4p", ".aa", ".wav")
|
audio_ext = (".mp3", ".m4a", ".m4b", ".m4p", ".aa", ".wav")
|
||||||
list_ext = (".pls", ".m3u")
|
list_ext = (".pls", ".m3u")
|
||||||
|
|
@ -439,9 +440,8 @@ class Playlist(Record):
|
||||||
return fullPath
|
return fullPath
|
||||||
|
|
||||||
def populate(self, filename):
|
def populate(self, filename):
|
||||||
f = open(filename, "rb")
|
with open(filename, 'rb') as f:
|
||||||
data = f.readlines()
|
data = f.readlines()
|
||||||
f.close()
|
|
||||||
|
|
||||||
extension = os.path.splitext(filename)[1].lower()
|
extension = os.path.splitext(filename)[1].lower()
|
||||||
if extension == '.pls':
|
if extension == '.pls':
|
||||||
|
|
@ -528,9 +528,8 @@ class Shuffler(object):
|
||||||
self.lists.append(os.path.abspath(os.path.join(dirpath, filename)))
|
self.lists.append(os.path.abspath(os.path.join(dirpath, filename)))
|
||||||
|
|
||||||
def write_database(self):
|
def write_database(self):
|
||||||
f = open(os.path.join(self.base, "iPod_Control", "iTunes", "iTunesSD"), "wb")
|
with open(os.path.join(self.base, "iPod_Control", "iTunes", "iTunesSD"), "wb") as f:
|
||||||
f.write(self.tunessd.construct())
|
f.write(self.tunessd.construct())
|
||||||
f.close()
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Read all files from the directory
|
# Read all files from the directory
|
||||||
|
|
@ -571,7 +570,21 @@ def nonnegative_int(string):
|
||||||
raise argparse.ArgumentTypeError("Track gain value should be in range 0-99")
|
raise argparse.ArgumentTypeError("Track gain value should be in range 0-99")
|
||||||
return intval
|
return intval
|
||||||
|
|
||||||
|
def checkPathValidity(path):
|
||||||
|
if not os.path.isdir(result.path):
|
||||||
|
print "Error finding IPod directory. Maybe it is not connected or mounted?"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if not os.access(result.path, os.W_OK):
|
||||||
|
print 'Unable to get write permissions in the IPod directory'
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
def handle_interrupt(signal, frame):
|
||||||
|
print "Interrupt detected, exiting..."
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
signal.signal(signal.SIGINT, handle_interrupt)
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--disable-voiceover', action='store_true', help='Disable voiceover feature')
|
parser.add_argument('--disable-voiceover', action='store_true', help='Disable voiceover feature')
|
||||||
parser.add_argument('--rename-unicode', action='store_true', help='Rename files causing unicode errors, will do minimal required renaming')
|
parser.add_argument('--rename-unicode', action='store_true', help='Rename files causing unicode errors, will do minimal required renaming')
|
||||||
|
|
@ -579,9 +592,7 @@ if __name__ == '__main__':
|
||||||
parser.add_argument('path', help='Path to the IPod\'s root directory')
|
parser.add_argument('path', help='Path to the IPod\'s root directory')
|
||||||
result = parser.parse_args()
|
result = parser.parse_args()
|
||||||
|
|
||||||
if not os.path.isdir(result.path):
|
checkPathValidity(result.path)
|
||||||
print "Error finding IPod directory. Maybe it is not connected or mounted?"
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
if result.rename_unicode:
|
if result.rename_unicode:
|
||||||
check_unicode(result.path)
|
check_unicode(result.path)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue