示例#1
0
sys.path.append(abspath(dirname(dirname(getcwd()))))
sys.path.append(abspath(dirname(dirname(dirname(getcwd())))))
os.environ['DJANGO_SETTINGS_MODULE'] = 'gramafon.settings'

from django.conf import settings
from gramafon.web.models import File, Singer, Album, Song
from gramafon.utils.id3.handler import MP3FileInfo as ID3Manager
from gramafon.utils.logger import Logger

logger = Logger()

soap = LyricWiki_services.LyricWikiBindingSOAP(
    "http://lyrics.wikia.com/server.php")  #added to get song lyrics
songlyric = LyricWiki_services.getSongRequest()

logger.message("Path: %s" % settings.ARCHIEVE_PATH)
for root, dirs, files in os.walk(settings.ARCHIEVE_PATH):
    for f in files:

        prefix, fileExtension = os.path.splitext(f)
        if fileExtension[1:] not in list(settings.MEDIA_FORMATS):
            continue

        path = os.path.join(root, f)
        md5 = hashlib.md5(open(path, 'r').read()).hexdigest()
        sha1 = hashlib.sha1(open(path, 'rb').read()).hexdigest()

        result = File.objects.filter(md5=md5)
        size = os.path.getsize(path)
        logger.message("\tsize: %s bayt" % size)
示例#2
0
logger = Logger()
for root, dirs, files in os.walk(settings.ARCHIEVE_PATH):
    for f in files:

        prefix, fileExtension = os.path.splitext(f)
        if fileExtension[1:] not in list(settings.MEDIA_FORMATS):
            continue

        path = os.path.join(root, f)
	music = pyglet.media.load(path) #You need to install libavbin-dev
	player=media.Player()
    	player.queue(music)
    	player.play()
    	try:
		logger.message("\tNow: %s" % f)
		logger.message("\tLength: %s bayt" % music.duration) # music.duration is the song length	
		def exit_callback(dt):
    			pyglet.app.exit()
		pyglet.clock.schedule_once(exit_callback , music.duration) #
        	pyglet.app.run()
    	except KeyboardInterrupt:
        	player.next()







示例#3
0
sys.path.append(abspath(dirname(dirname(getcwd()))))
sys.path.append(abspath(dirname(dirname(dirname(getcwd())))))
os.environ['DJANGO_SETTINGS_MODULE'] = 'gramafon.settings'

from django.conf import settings
from gramafon.web.models import File,Singer,Album, Song
from gramafon.utils.id3.handler import MP3FileInfo as ID3Manager
from gramafon.utils.logger import Logger

logger = Logger()

soap = LyricWiki_services.LyricWikiBindingSOAP("http://lyrics.wikia.com/server.php") #added to get song lyrics
songlyric = LyricWiki_services.getSongRequest()

logger.message("Path: %s" % settings.ARCHIEVE_PATH)
for root, dirs, files in os.walk(settings.ARCHIEVE_PATH):
    for f in files:

        prefix, fileExtension = os.path.splitext(f)
        if fileExtension[1:] not in list(settings.MEDIA_FORMATS):
            continue

        path = os.path.join(root, f)
	md5=hashlib.md5(open(path, 'r').read()).hexdigest()
	sha1=hashlib.sha1(open(path, 'rb').read()).hexdigest()

        result = File.objects.filter(md5=md5)
        size=os.path.getsize(path)
        logger.message("\tsize: %s bayt" % size)