예제 #1
0
 def get(self):
     self.write(
         self.render_string("bare_header.html", title="Adding Groups"))
     self.write("<h2>Associating Groups</h2>")
     self.write("<h3>These Songs:</h3><ul>")
     songs = cache.get_user(self.user, "admin_associate_groups_songs") or []
     for song_id in songs:
         song = Song.load_from_id(song_id)
         self.write("<li>%s</li>" % song.data['title'])
     self.write("</ul><h3>Songs In These Albums:</h3><ul>")
     albums = cache.get_user(self.user,
                             "admin_associate_groups_albums") or []
     for album_set in albums:
         album = Album.load_from_id(album_set[0])
         self.write(
             "<li>%s (%s)</li>" %
             (album.data['name'], config.station_id_friendly[album_set[1]]))
     self.write("</ul><select id='associate_group_id'>")
     for row in db.c.fetch_all(
             "SELECT group_id, group_name FROM r4_groups ORDER BY group_name"
     ):
         self.write("<option value='%s'>%s</option>" %
                    (row['group_id'], row['group_name']))
     self.write("</select><br />")
     self.write(
         "<button onclick=\"window.location.href='/admin/tools/associate_groups_finish/' + document.getElementById('associate_group_id').value\">Associate</button>"
     )
     self.write(
         "<br /><br /><a href='/admin/tools/associate_groups_cache_reset'>Reset the list above.</a>"
     )
     self.write(self.render_string("basic_footer.html"))
예제 #2
0
파일: groups.py 프로젝트: Dinir/rainwave
 def post(self):
     s = Song.load_from_id(self.get_argument("song_id"))
     s.remove_group_id(self.get_argument("group_id"))
     self.append(self.return_name, {
         "success": "true",
         "tl_key": "Group removed from song ID."
     })
예제 #3
0
def scan_file(args, filename):
	if _is_mp3(filename):
		update_tag(args, filename)

		s = Song()
		s.load_tag_from_file(filename)

		print
		print "--- %s" % filename
		print "Title".ljust(10), ":", s.data['title']
		print "Album".ljust(10), ":", s.album_tag
		print "Artist".ljust(10), ":", s.artist_tag
		print "CD Group".ljust(10), ":", s.genre_tag
		print "Link Name".ljust(10), ":", s.data['link_text']
		print "Link".ljust(10), ":", s.data['url']
		print "Length".ljust(10), ":", "%s:%02u" % (int(math.floor(s.data['length'] / 60)), (s.data['length'] % 60))
		print "Gain".ljust(10), ":", s.replay_gain	
예제 #4
0
파일: groups.py 프로젝트: Dinir/rainwave
 def post(self):
     s = Song.load_from_id(self.get_argument("song_id"))
     #If comma-separated values, will do each individually
     for group in self.get_argument("group").split(","):
         s.add_group(group.strip())
     self.append(self.return_name, {
         "success": "true",
         "text": "Group added to song."
     })
예제 #5
0
def scan_file(args, filename):
    if _is_mp3(filename):
        update_tag(args, filename)

        s = Song()
        s.load_tag_from_file(filename)

        print
        print "--- %s" % filename
        print "Title".ljust(10), ":", s.data['title']
        print "Album".ljust(10), ":", s.album_tag
        print "Artist".ljust(10), ":", s.artist_tag
        print "CD Group".ljust(10), ":", s.genre_tag
        print "Link Name".ljust(10), ":", s.data['link_text']
        print "Link".ljust(10), ":", s.data['url']
        print "Length".ljust(10), ":", "%s:%02u" % (int(
            math.floor(s.data['length'] / 60)), (s.data['length'] % 60))
        print "Gain".ljust(10), ":", s.replay_gain
예제 #6
0
def scan_file(args, filename):
    if _is_mp3(filename):
        update_tag(args, filename)

        s = Song()
        s.load_tag_from_file(filename)

        print()
        print("--- %s" % filename)
        print("Title".ljust(10), ":", s.data["title"])
        print("Album".ljust(10), ":", s.album_tag)
        print("Artist".ljust(10), ":", s.artist_tag)
        print("CD Group".ljust(10), ":", s.genre_tag)
        print("Link Name".ljust(10), ":", s.data["link_text"])
        print("Link".ljust(10), ":", s.data["url"])
        print(
            "Length".ljust(10),
            ":",
            "%s:%02u" % (int(math.floor(s.data["length"] / 60)),
                         (s.data["length"] % 60)),
        )
예제 #7
0
	def get(self):
		self.write(self.render_string("bare_header.html", title="Adding Groups"))
		self.write("<h2>Associating Groups</h2>")
		self.write("<h3>These Songs:</h3><ul>")
		songs = cache.get_user(self.user, "admin_associate_groups_songs") or []
		for song_id in songs:
			song = Song.load_from_id(song_id)
			self.write("<li>%s</li>" % song.data['title'])
		self.write("</ul><h3>Songs In These Albums:</h3><ul>")
		albums = cache.get_user(self.user, "admin_associate_groups_albums") or []
		for album_set in albums:
			album = Album.load_from_id(album_set[0])
			self.write("<li>%s (%s)</li>" % (album.data['name'], config.station_id_friendly[album_set[1]]))
		self.write("</ul><select id='associate_group_id'>")
		for row in db.c.fetch_all("SELECT group_id, group_name FROM r4_groups ORDER BY group_name"):
			self.write("<option value='%s'>%s</option>" % (row['group_id'], row['group_name']))
		self.write("</select><br />")
		self.write("<button onclick=\"window.location.href='/admin/tools/associate_groups_finish/' + document.getElementById('associate_group_id').value\">Associate</button>")
		self.write("<br /><br /><a href='/admin/tools/associate_groups_cache_reset'>Reset the list above.</a>")
		self.write(self.render_string("basic_footer.html"))
예제 #8
0
#!/usr/bin/env python

import argparse

from libs import config
from libs import db
from libs import log
from rainwave.playlist import Song

if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description="Recalculates all song global ratings.  Can take a while."
    )
    parser.add_argument("--config", default=None)
    args = parser.parse_args()
    config.load(args.config)
    log.init()
    db.connect()

    songs = db.c.fetch_list("SELECT song_id FROM r4_songs")
    i = 0
    for song_id in songs:
        txt = "Song %s / %s" % (i, len(songs))
        txt += " " * (80 - len(txt))
        print("\r" + txt, end="")
        i += 1

        s = Song.load_from_id(song_id)
        s.update_rating(skip_album_update=True)
예제 #9
0
파일: groups.py 프로젝트: Dinir/rainwave
	def post(self):
		s = Song.load_from_id(self.get_argument("song_id"))
		s.remove_group_id(self.get_argument("group_id"))
		self.append(self.return_name, { "success": "true", "tl_key": "Group removed from song ID." })
예제 #10
0
파일: groups.py 프로젝트: Dinir/rainwave
	def post(self):
		s = Song.load_from_id(self.get_argument("song_id"))
		#If comma-separated values, will do each individually
		for group in self.get_argument("group").split(","):
			s.add_group(group.strip())
		self.append(self.return_name, { "success": "true", "text": "Group added to song." })
예제 #11
0
#!/usr/bin/python

import argparse

from libs import config
from libs import db
from rainwave.playlist import Song

if __name__ == "__main__":
	parser = argparse.ArgumentParser(description="Recalculates all song global ratings.  Can take a while.")
	parser.add_argument("--config", default=None)
	args = parser.parse_args()
	config.load(args.config)
	db.connect()

	songs = db.c.fetch_list("SELECT song_id FROM r4_songs")
	i = 0
	for song_id in songs:
		txt = "Song %s / %s" % (i, len(songs))
		txt += " " * (80 - len(txt))
		print "\r" + txt,
		i += 1

		s = Song.load_from_id(song_id)
		s.update_rating(skip_album_update=True)
예제 #12
0
파일: tagset.py 프로젝트: Reani/rainwave
#!/usr/bin/python

import argparse
from rainwave.playlist import Song

parser = argparse.ArgumentParser(description="Read or set tags using Rainwave's ID3 tag code.  To set tags, supply any on the commandline.")
parser.add_argument("file", metavar='N', help = "File or directory. (recursive)")
parser.add_argument("--album")
parser.add_argument("--artist")
parser.add_argument("--genre")
parser.add_argument("--track")
parser.add_argument("--title")
parser.add_argument("--length")
parser.add_argument("--year")

args = parser.parse_args()

s = Song()
s.load_tag_from_file(args.file)

for k, v in s.to_dict().iteritems():
	print "%s: %s" % (k, v)
예제 #13
0
파일: tagset.py 프로젝트: Reani/rainwave
#!/usr/bin/python

import argparse
from rainwave.playlist import Song

parser = argparse.ArgumentParser(
    description=
    "Read or set tags using Rainwave's ID3 tag code.  To set tags, supply any on the commandline."
)
parser.add_argument("file", metavar='N', help="File or directory. (recursive)")
parser.add_argument("--album")
parser.add_argument("--artist")
parser.add_argument("--genre")
parser.add_argument("--track")
parser.add_argument("--title")
parser.add_argument("--length")
parser.add_argument("--year")

args = parser.parse_args()

s = Song()
s.load_tag_from_file(args.file)

for k, v in s.to_dict().iteritems():
    print "%s: %s" % (k, v)