Skip to content

Commit

Permalink
small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
xxruyle committed Apr 27, 2022
1 parent ef027ea commit b05a628
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ python main.py

✅ Error handling

- [ ] Refactoring

- [ ] PyQT


# Credits
- Made for educational purposes

Expand Down
9 changes: 4 additions & 5 deletions bandcampdl/objects.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from bs4 import BeautifulSoup
from mutagen.id3 import ID3, ID3NoHeaderError, TIT2, TALB, TPE1, TPE2, TDRC, TRCK, APIC, TCOM, TCON
from mutagen.id3 import ID3, ID3NoHeaderError, TIT2, TALB, TPE1, TPE2, TDRC, TRCK, APIC, TCON
import requests
import os
import sys
Expand All @@ -22,9 +22,8 @@ def get_html(self): # gets the enitre html of the page

def get_script(self): # gets the text from <script>s
try:
response = requests.get(self.link)
url = response.content
soup = BeautifulSoup(url, 'html.parser')
response = requests.get(self.link).content
soup = BeautifulSoup(response, 'html.parser')
links = soup.find_all("script")
return links
except requests.exceptions.MissingSchema:
Expand Down Expand Up @@ -158,7 +157,6 @@ def download(self):

meta['TRCK'] = TRCK(encoding=3, text=[meta_info.get_trackname(self)[list(meta_info.get_trackname(self))[i]]]) # track number
meta['TIT2'] = TIT2(encoding=3, text=[list(meta_info.get_trackname(self))[i]]) # track name
meta['TCOM'] = TCOM(encoding=3, text=[meta_info.get_artist(self)]) #album composer
meta['TCON'] = TCON(encoding=3, text=[meta_info.get_genre(self)]) #genre
meta['TPE1'] = TPE1(encoding=3, text=[meta_info.get_artist(self)]) #contributing artist
meta['TPE2'] = TPE2(encoding=3, text=[meta_info.get_artist(self)]) #album artist
Expand All @@ -181,3 +179,4 @@ def download(self):




0 comments on commit b05a628

Please sign in to comment.