Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
IM-TechieScientist committed Nov 13, 2023
1 parent 5c7389a commit 58d130f
Show file tree
Hide file tree
Showing 24 changed files with 978 additions and 885 deletions.
2 changes: 1 addition & 1 deletion .cache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"access_token": "BQCxvhckqHye3r2YO1N_kyeCCJOWIG_DPF616ShpW0lGycIxvNW_j39DefMLkBRMqXx2AQXSUeCrCpSY70pYbKSDaasqPkYCJ1QLU1KQgU1ppV9ncto", "token_type": "Bearer", "expires_in": 3600, "expires_at": 1699887728}
{"access_token": "BQDyyOKPNqjgYeiOimP-ySnCeL34UXLtR2ufvvfiBdMixRXH4bYoi31gOG6EnjzCLI4niDYm9ZMtjmNjJSQL9e3DEUuneCPu8iQoaFyjDxkBrBYskBo", "token_type": "Bearer", "expires_in": 3600, "expires_at": 1699897748}
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion db.py → app/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
#con=sqlite3.connect("d:\songs2.db", isolation_level=None)

con=sqlite3.connect(os.getcwd()+"/database.db",check_same_thread=False)
con=sqlite3.connect(os.getcwd()+"/data/database.db",check_same_thread=False)

def init():
global cur
Expand Down
18 changes: 8 additions & 10 deletions functions.py → app/functions.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import os
import time
import threading
import pickle
from youtubesearchpython import VideosSearch
import yt_dlp as youtube_dl
import requests
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
import db
import app.db as db


with open("secrets.dat","rb") as credentials:
with open("data/secrets.dat","rb") as credentials:
temp_cred=pickle.load(credentials)
client_credentials_manager = SpotifyClientCredentials(client_id=temp_cred[0], client_secret=temp_cred[1])
sp = spotipy.Spotify(client_credentials_manager = client_credentials_manager)
Expand All @@ -31,17 +29,17 @@

def check_recents():
try:
file=open("recents.dat","rb+")
file=open("data/recents.dat","rb+")
except FileNotFoundError:
file=open("recents.dat","wb+")
file=open("data/recents.dat","wb+")
pickle.dump([{},{},{}],file)
finally:
file.close()

check_recents()

def store_recents(song_dict):
file=open("recents.dat","rb+")
file=open("data/recents.dat","rb+")
file.seek(0,0)
L=pickle.load(file)
L.pop()
Expand All @@ -51,7 +49,7 @@ def store_recents(song_dict):
file.close()

def get_recents():
file=open("recents.dat","rb")
file=open("data/recents.dat","rb")
file.seek(0,0)
recent=pickle.load(file)
return recent
Expand Down Expand Up @@ -121,13 +119,13 @@ def search(stringy):
db_search=db.song_search(pretty_name)
if db_search:
print("found in db")
thumbnail_path=db_search["thumbnail"]

thumbnail_path=thumbs(better_name(pretty_name),thumbnail_url)
else:
print("not found in db downloading thumb")
thumbnail_path=thumbs(better_name(pretty_name),thumbnail_url)
db.song_insert([stringy,url,duration,pretty_name,thumbnail_path,artists])
print("added record to db")

return {"path":stringy,"url":url,"duration":duration,"pretty_name":pretty_name,"thumbnail_path":thumbnail_path,"artists":artists}

def artist_search(pretty_name):
Expand Down
2 changes: 1 addition & 1 deletion lyrics.py → app/lyrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import customtkinter as ctk
import lyricsgenius

with open("secrets.dat","rb") as cred:
with open("data/secrets.dat","rb") as cred:
genius = lyricsgenius.Genius(pickle.load(cred)[2])


Expand Down
Loading

0 comments on commit 58d130f

Please sign in to comment.