View Single Post
Old Jun 28th, 2005, 7:55 PM   #2
SaturN
Programmer
 
Join Date: Apr 2005
Location: Uk
Posts: 68
Rep Power: 4 SaturN is on a distinguished road
Just so's that no one can so, But what if i have the same song in other directories, it's gonna show up twice...

import os
path = "C:\Documents and Settings\Sam\Desktop\music_dir.html"
html = open(path, 'w')
html.write("""
<HTML>
<HEAD>
<TITLE>Entire Music Collection</TITLE>
</HEAD>
<BODY background="C:\Documents and Settings\Sam\Desktop\Programs\HTML Music File\roses.jpg" align="center">
<HR>
<H1 align="center">Music Libary</H1>
<HR>
<P align="center">All Songs Are Accesable By Clicking On Them</P>
""")
paths = []
items = []
while(1):
    paths.append(raw_input("Path Name: "))
    b = raw_input("Enter Another Path? (Y/N) ")
    if b.lower() == "y":
        b = "y"
    else:
        break
lists = []
for a in range(len(paths)):
    path = paths[a]
    for root, dirs, files in os.walk(path, topdown=False):
        for name in files:
            if os.path.join(root, name).endswith(".wma") or os.path.join(root, name).endswith(".mp3"):
                item1 = os.path.join(root, name)
                item2 = os.path.join(name)
                item = '<P align="center"><A href="',item1,'">',item2,"</A></P>"
                item = "".join(item)
                item = str(item)
                if os.path.join(name) in lists:
                    print "Already Located"
                if os.path.join(name) not in lists:
                    lists.append(os.path.join(name))
                    items.append(item)
for a in range(len(items)):
    html.write(items[a])
html.write("""
<P>Music Collections From SaturN</P>
</BODY>
</HTML>
""")
html.close()

There we go, works fine or me
__________________
while me is alive:
	make(life,simple)
SaturN is offline   Reply With Quote