mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28:09 -06:00
Merge pull request #286 from pauliyobo/next-gen
audio_services should now be completely independent from the source …
This commit is contained in:
commit
7f86da1123
@ -1,8 +1,8 @@
|
||||
from audio_services import matches_url
|
||||
import json
|
||||
import re
|
||||
import urllib
|
||||
import youtube_utils
|
||||
import requests
|
||||
|
||||
|
||||
|
||||
@matches_url('https://audioboom.com')
|
||||
def convert_audioboom(url):
|
||||
@ -14,16 +14,14 @@ def convert_audioboom(url):
|
||||
@matches_url ('https://soundcloud.com/')
|
||||
def convert_soundcloud (url):
|
||||
client_id = "df8113ca95c157b6c9731f54b105b473"
|
||||
permalink = urllib.urlopen ('http://api.soundcloud.com/resolve.json?client_id=%s&url=%s' %(client_id, url))
|
||||
if permalink.getcode () == 404:
|
||||
permalink.close ()
|
||||
raise TypeError('%r is not a valid URL' % url)
|
||||
with requests.get('http://api.soundcloud.com/resolve.json', client_id=client_id, url=url) as permalink:
|
||||
if permalink.status_code==404:
|
||||
raise TypeError('%r is not a valid URL' % permalink.url)
|
||||
else:
|
||||
resolved_url = permalink.geturl ()
|
||||
permalink.close ()
|
||||
track_url = urllib.urlopen (resolved_url)
|
||||
track_data = json.loads (track_url.read ())
|
||||
track_url.close ()
|
||||
resolved_url = permalink.url
|
||||
with requests.get(resolved_url) as track_url:
|
||||
track_data = track_url.json()
|
||||
|
||||
if track_data ['streamable']:
|
||||
return track_data ['stream_url'] + "?client_id=%s" %client_id
|
||||
else:
|
||||
|
@ -1,4 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
import time
|
||||
import platform
|
||||
if platform.system() == "Windows":
|
||||
@ -17,7 +17,7 @@ import config
|
||||
import sound
|
||||
import languageHandler
|
||||
import logging
|
||||
import youtube_utils
|
||||
from audio_services import youtube_utils
|
||||
from controller.buffers import baseBuffers
|
||||
from sessions.twitter import compose, utils
|
||||
from mysc.thread_utils import call_threaded
|
||||
|
@ -4,7 +4,7 @@ import platform
|
||||
system = platform.system()
|
||||
import application
|
||||
import requests
|
||||
import youtube_utils
|
||||
from audio_services import youtube_utils
|
||||
import arrow
|
||||
if system == "Windows":
|
||||
from update import updater
|
||||
|
BIN
src/snapshot.zip
Normal file
BIN
src/snapshot.zip
Normal file
Binary file not shown.
@ -11,7 +11,7 @@ import audio_services
|
||||
import paths
|
||||
import sound_lib
|
||||
import output
|
||||
import youtube_utils
|
||||
from audio_services import youtube_utils
|
||||
import application
|
||||
system = platform.system()
|
||||
if system=="Windows" and not hasattr(sys, 'frozen'): # We are running from source on Windows
|
||||
|
Loading…
Reference in New Issue
Block a user