parent
d41c248435
commit
2589b133d9
|
@ -411,17 +411,24 @@ def owner_id(original_path):
|
||||||
def file_playable(pathname):
|
def file_playable(pathname):
|
||||||
""" Returns True if 'pathname' is playable by liquidsoap. False
|
""" Returns True if 'pathname' is playable by liquidsoap. False
|
||||||
otherwise. """
|
otherwise. """
|
||||||
|
#remove all write permissions. This is due to stupid taglib library bug
|
||||||
|
#where all files are opened in write mode. The only way around this is to
|
||||||
|
#modify the file permissions
|
||||||
|
os.chmod(pathname, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)
|
||||||
|
|
||||||
# when there is an single apostrophe inside of a string quoted by
|
# when there is an single apostrophe inside of a string quoted by
|
||||||
# apostrophes, we can only escape it by replace that apostrophe with
|
# apostrophes, we can only escape it by replace that apostrophe with
|
||||||
# '\''. This breaks the string into two, and inserts an escaped
|
# '\''. This breaks the string into two, and inserts an escaped
|
||||||
# single quote in between them. We run the command as pypo because
|
# single quote in between them.
|
||||||
# otherwise the target file is opened with write permissions, and
|
|
||||||
# this causes an inotify ON_CLOSE_WRITE event to be fired :/
|
|
||||||
command = ("airtime-liquidsoap -c 'output.dummy" + \
|
command = ("airtime-liquidsoap -c 'output.dummy" + \
|
||||||
"(audio_to_stereo(single(\"%s\")))' > /dev/null 2>&1") % \
|
"(audio_to_stereo(single(\"%s\")))' > /dev/null 2>&1") % \
|
||||||
pathname.replace("'", "'\\''")
|
pathname.replace("'", "'\\''")
|
||||||
return True
|
|
||||||
return_code = subprocess.call(command, shell=True)
|
return_code = subprocess.call(command, shell=True)
|
||||||
|
|
||||||
|
#change/restore permissions to acceptable
|
||||||
|
os.chmod(pathname, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH | \
|
||||||
|
stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH)
|
||||||
return (return_code == 0)
|
return (return_code == 0)
|
||||||
|
|
||||||
def toposort(data):
|
def toposort(data):
|
||||||
|
|
Loading…
Reference in New Issue