mirror of
https://github.com/nims11/IPod-Shuffle-4g.git
synced 2025-12-08 00:18:01 +09:00
directory permission check, non zero return status
This commit is contained in:
parent
6b60656db6
commit
002be77edb
1 changed files with 10 additions and 3 deletions
13
shuffle.py
13
shuffle.py
|
|
@ -571,6 +571,15 @@ 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)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
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')
|
||||||
|
|
@ -579,9 +588,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