Skip to content

Instantly share code, notes, and snippets.

@X-88
Last active October 29, 2019 14:36
Show Gist options
  • Save X-88/6dc664164287a4570c4289c7351f6910 to your computer and use it in GitHub Desktop.
Save X-88/6dc664164287a4570c4289c7351f6910 to your computer and use it in GitHub Desktop.
Playlist Generator M3U
####################################
## App Name: Z-PlayList Generator ##
## Language : Python 3xx. ##
## Coded by: Zephio ##
## Date : 16-Nop-2018 ##
## Target : M3U. ##
####################################
import os
x = 0
h = '#EXTM3U'
i = '#EXTInf'
ifn = "/storage/emulated/0/List.txt" #Input Path
ofn = "/storage/emulated/0/ZPlayList.m3u" #Output Path
if os.path.isfile(ifn) and os.access(ifn, os.R_OK):
print ('\n ##############################\n App Name: Z-Playlist Generator\n Coded by: Zephio\n Date: 16-11-2018\n ##############################\n Info: File Exists\n Process Done!...')
else:
print ('info: file not found')
with open(ifn, 'r') as f:
l = list(f)
with open(ofn, 'w') as s:
s.writelines(h + '\n')
while x < len(l):
a = os.path.basename(l[x])
b = format('%s: %d, %s' % (i, x + 1, a))
s.write(b)
s.write(l[x])
x += 1
f.close()
s.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment