-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now able to instantly upload downloaded music from bandcamp to YouTube Music
- Loading branch information
Showing
10 changed files
with
91 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
__pycache__ | ||
headers_auth.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Change Log | ||
--- | ||
## v1.0.0 - April 23, 2022 | ||
Initial release | ||
|
||
- Script which downloads song or album from bandcamp | ||
|
||
## v1.0.1 - May 5, 2022 | ||
YouTube music upload support | ||
|
||
|
||
- ytmusicapi support | ||
- upload_songs() method in youtube_music.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
PATH = "C:\Music" # default path | ||
PATH = "C:/Music" # default path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from ytmusicapi import YTMusic | ||
from os import listdir | ||
|
||
class YTM_upload(): | ||
'''Class which deals with YT Music api uploads''' | ||
def __init__(self): | ||
self.ytmusic = YTMusic("headers_auth.json") # Place the path to your headers_auth.json here | ||
|
||
def upload_songs(self, album_folder): | ||
for song in listdir(album_folder): | ||
if ".mp3" in song: # Makes sure non mp3 files do not get uploaded | ||
print(f"Uploading... {song}") | ||
self.ytmusic.upload_song(f"{album_folder}/{song}") | ||
|
||
print("Success!") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,28 @@ | ||
import bandcampdl | ||
import sys | ||
|
||
sys.stdout.reconfigure(encoding='utf-8') # Fixes git bash crashes | ||
|
||
# Customize the main function however you like by using the methods found in objects.py | ||
# Customize the main function however you like by using the methods found in objects.py or youtube_music.py | ||
|
||
# This main() function downloads songs taken from bandcamp and adds the corresponding metadata to each one | ||
def main(): | ||
''' Customize the main function however you like by using the methods found in objects.py or youtube_music.py | ||
This main() function downloads songs taken from bandcamp and adds the corresponding metadata to each one. | ||
It also can upload the songs to YTMusic if ytmusicapi setup is followed. | ||
''' | ||
|
||
link = input("Enter Bandcamp link: ") | ||
dl = bandcampdl.downloader(link, bandcampdl.PATH) | ||
dl.download() | ||
|
||
# dl.download downloads the songs from the inputted link | ||
album_folder = dl.download() | ||
|
||
# Remove this if you do not want to upload songs to YT Music | ||
#u1 = bandcampdl.YTM_upload() | ||
#u1.upload_songs(album_folder) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
#File for testing functions | ||
import requests | ||
from bs4 import BeautifulSoup | ||
|
||
string = "//" | ||
|
||
print(string.isalnum()) | ||
from ytmusicapi import YTMusic | ||
|
||
def badchar(self, string): # Removes illegal filename characters | ||
for c in '\/:*?"<>|': | ||
string = string.replace(c,'-') | ||
return string; | ||
return string; | ||
|
||
|
||
ytmusic = YTMusic("headers_auth.json") | ||
|