示例#1
0
def getcoverURL(search, resultCount=10):
    '''
    It will return the URL to coverart image
    '''
    extra.cls()
    # search = "drishyam"
    # resultCount = 10
    # This Custom Search Engine of google, search on www.saavn.com
    #  and itunes.apple.com for albums
    searchengineid = "014954134512375095903%3A1jlepwhgf1k"
    APIKey = str(raw_input("Please enter your Google API Key \n \
        Press 0 to browse image instead from your computer\n>> "))
    if APIKey == '0':
        return False
    print "Searching for " + search + "\n Do you wish to change album name (Y/N)?"
    ch = str(raw_input(">> ")).lower()
    if ch == 'y':
        search = str(raw_input("Enter Album name to search\n>> "))
    extra.log("Searching for " + search + "\n")
    url = "https://www.googleapis.com/customsearch/v1?" + \
        "q=" + search + \
        "&num=" + str(resultCount) + \
        "&cx=" + searchengineid + \
        "&key=" + APIKey
    extra.log("SearchURL = " + url)

    try:
        source = urlopen(url)
    except:
        extra.log("Can't connect to internet, unable to edit cover image")
        raw_input("Internet Issues, Press any key to browse cover image")
        return False
    # source = open('json.txt').read()

    parsedJSON = json_loads(source.read())

    if "error" in parsedJSON:
        extra.log("Please Update API Key")
        return False

    i = 1
    for each in parsedJSON["items"]:
        print i, each["title"], each["displayLink"]
        i += 1
    print "Enter your choice\n>> ",
    ch = int(input())
    # ch = 4
    url = parsedJSON["items"][ch - 1]["pagemap"]["cse_image"][0]["src"]
    if parsedJSON["items"][ch - 1]["displayLink"] == "www.saavn.com":
        pass
    else:
        url = url.replace("326x326", "600x600")

    return url
示例#2
0
def printMenu(mp31):
    extra.cls()
    print """
        +-------------------------------+
        +                               +
        +      MP3 Tag Auto-editor      +
        +                               +
        +-------------------------------+
      1. Select Album (""" + getFinalTag(
        mp31, "album"
    ) + """)
      2. Edit Artist Pattern (""" + getFinalTag(
        mp31, "artist"
    ) + """)
      3. Edit Title Pattern (""" + getFinalTag(
        mp31, "title"
    ) + """)
      4. Select Genre (""" + getFinalTag(
        mp31, "genre"
    ) + """)
      5. Select Year (""" + getFinalTag(
        mp31, "year"
    ) + """)
      6. Edit Album-Artist Pattern (""" + getFinalTag(
        mp31, "album_artist"
    ) + """)
      7. Edit Track Number Pattern (""" + getFinalTag(
        mp31, "track_num"
    ) + """)
      8. Select Total Track Number (""" + getFinalTag(
        mp31, "total_track"
    ) + """)
      9. Select Artist (""" + getFinalTag(
        mp31, "artist"
    ) + """) (Change for all MP3s)
     10. Select Album-Artist (""" + getFinalTag(
        mp31, "album_artist"
    ) + """) (Change for all MP3s)
     11. Select Cover-Art ('coverart.jpg' will be used by default in selected folder)
      0. ~~~ Do the Magic ~~~
      Enter Choice >> """,
示例#3
0
from tkFileDialog import askdirectory
from eyed3 import load as eyed3load
import coverimage
import extra
from os import listdir as os_listdir, rename as os_rename
from Tkinter import Tk

extra.cls()

# Initial Welcome Message
print """

    This program can be used to quickly edit tags.
    Works great with MP3 folder

    NOT TO BE USED WITH FOLDER, CONTAINING MP3 FROM DIFF ALBUMs

    Press any key to continue, and select the folder to start the process

>> """,

raw_input()

root = Tk()
root.withdraw()
extra.clearlog()

dirname = askdirectory(parent=root, title="Please select a directory")
extra.log("Dirname = " + dirname)
extra.cls()
# dirname = r'/home/ashwani/Music'