Ejemplo n.º 1
0
 def __init__(self, aContext):
     self.aContext = aContext
     self.normalizer = WordNormalizer()
     self.wordArray = []
     self.wordDict = {}
     self.artistNameDict = {}
     self.albumNameDict = {}
     self.jm = JSONManager(self.aContext)
Ejemplo n.º 2
0
 def formatTextAndSaveToJson(self, originalFileName, deleteFileName):
     jm = JSONManager(self.aContext)
     for key in jm.readJson(originalFileName):
         self.lDeleter.edits = []
         deletedWords = self.lDeleter.delete(key, 3)
         deletedWords.append(key)
         for deletedWord in deletedWords:
             self.formatWordDict(deletedWord, key)
     jm.writeJSON(deleteFileName, self.wordDeletesDict)
Ejemplo n.º 3
0
 def __init__(self, aContext):
     self.aContext = aContext
     self.jsonM = JSONManager(self.aContext)
     self.deletedWordsDB = ""
     self.originalWordsDB = ""
     self.songsDB = ""
     self.originalNamesDB= ""
     self.deletedNamesDB = ""
     self.originalAlbumsDB = ""
     self.deletedAlbumsDB = ""
Ejemplo n.º 4
0
class JsonDB():

    def __init__(self, aContext):
        self.aContext = aContext
        self.jsonM = JSONManager(self.aContext)
        self.deletedWordsDB = ""
        self.originalWordsDB = ""
        self.songsDB = ""
        self.originalNamesDB= ""
        self.deletedNamesDB = ""
        self.originalAlbumsDB = ""
        self.deletedAlbumsDB = ""

    def loadDeletedWordsDB(self):
        self.deletedWordsDB = self.jsonM.readJson('DeletedWords.json')

    def loadOriginalWordsDB(self):
        self.originalWordsDB = self.jsonM.readJson('OriginalWords.json')

    def loadSongsDB(self):
        self.songsDB = self.jsonM.readJson('5.json')

    def loadOriginalNamesDB(self):
        self.originalNamesDB = self.jsonM.readJson('OriginalArtistNames.json')

    def loadDeletedNamesDB(self):
        self.deletedNamesDB = self.jsonM.readJson('DeletedArtistNames.json')

    def loadDeletedAlbumsDB(self):
        self.deletedAlbumsDB = self.jsonM.readJson('DeletedAlbumNames.json')

    def loadOriginalAlbumsDB(self):
        self.originalAlbumsDB = self.jsonM.readJson('OriginalAlbumNames.json')

    def getDeletedAlbumsDB(self):
        return self.deletedAlbumsDB

    def getOriginalAlbumsDB(self):
        return self.originalAlbumsDB

    def getDeletedWordsDB(self):
        return self.deletedWordsDB

    def getOriginalWordsDB(self):
        return self.originalWordsDB

    def getSongsDB(self):
        return self.songsDB

    def getOriginalNamesDB(self):
        return self.originalNamesDB

    def getDeletedNamesDB(self):
        return self.deletedNamesDB
        
Ejemplo n.º 5
0
class JsonOriginalWordCreator():
    def __init__(self, aContext):
        self.aContext = aContext
        self.normalizer = WordNormalizer()
        self.wordArray = []
        self.wordDict = {}
        self.artistNameDict = {}
        self.albumNameDict = {}
        self.jm = JSONManager(self.aContext)

    def getDataFromFile(self, typ):
        data = self.jm.readJson('5.json')
        temp = []
        for song in data['Songs']:
            temp.append(song[typ])
        return temp

    def formatDictionary(self, word, songNum, dictionary):
        try:
            dictionary[word].append(songNum)
        except:
            dictionary[word] = []
            dictionary[word].append(songNum)

    def formatLyrics(self):
        i = 1
        for lyric in self.getDataFromFile('Lyrics'):
            self.normalizer.sOutput = []
            normalizedDict = self.normalizer.normalizeLyrics(lyric)
            for value in normalizedDict:
                #for key, value in normalizedDict.items():
                #self.formatLyricDictionary(key, value, i)
                self.formatDictionary(value, i, self.wordDict)
            i = i + 1
        self.jm.writeJSON('OriginalWords.json', self.wordDict)

    def formatArtistNames(self):
        i = 1
        for artist in self.getDataFromFile('Artist'):
            self.normalizer.artistNames = []
            artistNames = self.normalizer.normalizeArtistNames(artist)
            for artistName in artistNames:
                self.formatDictionary(artistName, i, self.artistNameDict)
            i = i + 1
        self.jm.writeJSON('OriginalArtistNames.json', self.artistNameDict)

    def formatAlbumNames(self):
        i = 1
        for album in self.getDataFromFile('Album'):
            self.normalizer.albumNames = []
            albumNames = self.normalizer.normalizeAlbumNames(album)
            for albumName in albumNames:
                self.formatDictionary(albumName, i, self.albumNameDict)
            i = i + 1
        self.jm.writeJSON('OriginalAlbumNames.json', self.albumNameDict)
Ejemplo n.º 6
0
    -   Marina Prieto Pech
    -   Sergio Silvestre Pavon
    -   Josue Carlos Zenteno Yave
"""
import sys
from Node import Node
from Maze import Maze
from art import tprint
from random import randint
from Frontier import Frontier
from JSONManager import JSONManager
from ImageManager import ImageManager
from ProblemExitMaze import ProblemExitMaze

##############################---Global---#################################
json_manager = JSONManager()
image_manager = ImageManager()
problem_solver = ProblemExitMaze()


###########################---Main methods---##############################
def main():
    print_header()
    while True:
        print_menu()


def generate_maze():
    rows, columns = get_rows_columns()
    maze = Maze(int(rows), int(columns))
    maze.generate_wilson()
Ejemplo n.º 7
0
def DeleteHTMLFiles():
    for file in os.listdir(os.getcwd()):
        if file.endswith(".html"):
            os.remove(file)


def SeasonEpisodeNumbersToString(season, episode):
    if len(str(episode)) == 1:
        episode = '0' + str(episode)
    if len((str(season))) == 1:
        season = '0' + str(season)
    return str(season), str(episode)


DeleteHTMLFiles()
jsonMan = JSONManager()
jsonMan.ReadJSONData()

resp = input("to download a movie type m, else, type any key: ").lower()
if resp == "m":
    movie = input("the name of the movie: ")
    mm = MovieManager(movie)
    mm.GetTorrentLink()
else:
    resp = input("to add a tv series, hit a, else hit any key: ")
    if resp == 'a':
        newSerial = input(
            "enter the data formatted this way: name of the tvseries,"
            "number of episode,number of season: ").split(",")
        serial = newSerial[0].strip()
        currentEpisode = newSerial[1].strip()