音乐排序 [英] Sorting music

查看:159
本文介绍了音乐排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,这些年来,我已经买了乐客的iTunes,恳请和Rhapsody和所有这些文件都躺在我已经扯下我的CD我的非DRM'd MP3文件混合。现在,有些文件有已经过期的许可证,其中一些具有有效的许可证。

So over the years, I've bought music off iTunes, Urge, and Rhapsody and all these files are lying mixed with my non-DRM'd MP3 files that I've ripped off my CDs. Now some of these files have licenses that have expired, and some of them have valid licenses.

我要整理我的音乐,他们有不同的DRM /许可限制他们。这将使它更容易为我要删除我没有订阅的音乐,都知道我可以在哪些音乐播放器随身携带哪些文件。

I want to sort my music by various DRM/license restrictions that they have on them. This will make it easier for my to delete the music that I don't have subscription to, and all know which files I can carry on which music player.

有谁知道这是可能的.NET /的Perl / Python的,即是否有任何可用的库,这将帮助我做到这一点?

Does anyone know if this is possible in .NET/Perl/Python i.e. are there any libraries available that will help me do this?

推荐答案

我也碰到过这个问题也和写了一个Python函数来解决它;我的建议是与DRM文件以减少你的损失和正义之举出来,你正在使用的播放列表等典型问题,任何程序被M4P与您的MP3和M4A的混合;无论你的混音这都drm'd文件移动到一个新的文件夹在 C:\drm_music

I have come across this problem too and wrote a python function to fix it; my advice is to cut your losses with the DRM files and just move them out of whatever program you are using for playlists etc. The typical issue is m4p's mixed in with your mp3's and m4a's; whatever your mix this will move all drm'd files into a new folder at C:\drm_music:

import os, shutil

def move_drm_files(music_folder):
    all_songs = []
    good_filetypes = ['mp3', 'm4a', 'ogg', 'flv', 'wma']
    for root, dirs, files in os.walk(music_folder):
        for name in files:
    	    full_name = os.path.join(root, name)
    	    all_songs.append(full_name)
    os.mkdir('/drm_music')
    for song in all_songs:
    	if song[-3:] not in good_filetypes:
    		shutil.move(song, '/drm_music')

所以,举例来说,你可以(为节省剧本 move_drm.py )运行上面蟒蛇-i move_drm.py 并调用 move_drm_files('/用户/ alienfluid /音乐'),所有的文件类型drm'd将被转移到自己的隔离文件夹中。如果你认为你可以节省一些那些你可以做到这一点按类型的DRM文件进行排序:

So for example you could run the above with python -i move_drm.py (saving the script as move_drm.py) and call move_drm_files('/users/alienfluid/music'), and all the drm'd filetypes would be moved to their own quarantined folder. If you think you can save some of those you could do this to sort the drm files by type:

def sort_drm(drm_folder, all_songs=[]):
    os.mkdir('/drm_collection')
    known_types = []
    for root, dirs, files in os.walk(drm_folder):
    	for name in files:
    		full_name = os.path.join(root, name)
    		all_songs.append(full_name)
    for item in all_songs:
    	if item[-3:] not in known_types:
    		known_types.append(item[-3:])
    for item in known_types:
    	os.mkdir('/drm_collection/'+item)
    for item in all_songs:
    	shutil.copy2(item, '/drm_collection/'+item[-3:])

这将创造一个文件夹 C:\drm_collection 名为其扩展名(M4P等)的子文件夹,它们将充满每个的所有实例类型;如果您运行的第一个功能,你可以只保存在同一文件中的第二个,并调用 sort_drm('/ drm_music')

This will create a folder at C:\drm_collection with subfolders named for their extension (m4p etc), and they will be filled with all instances of each type; if you run the first function, you could just save the second one in the same file and call sort_drm('/drm_music')

这篇关于音乐排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆