mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -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
|
from audio_services import matches_url
|
||||||
import json
|
|
||||||
import re
|
|
||||||
import urllib
|
|
||||||
import youtube_utils
|
import youtube_utils
|
||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@matches_url('https://audioboom.com')
|
@matches_url('https://audioboom.com')
|
||||||
def convert_audioboom(url):
|
def convert_audioboom(url):
|
||||||
@ -14,16 +14,14 @@ def convert_audioboom(url):
|
|||||||
@matches_url ('https://soundcloud.com/')
|
@matches_url ('https://soundcloud.com/')
|
||||||
def convert_soundcloud (url):
|
def convert_soundcloud (url):
|
||||||
client_id = "df8113ca95c157b6c9731f54b105b473"
|
client_id = "df8113ca95c157b6c9731f54b105b473"
|
||||||
permalink = urllib.urlopen ('http://api.soundcloud.com/resolve.json?client_id=%s&url=%s' %(client_id, url))
|
with requests.get('http://api.soundcloud.com/resolve.json', client_id=client_id, url=url) as permalink:
|
||||||
if permalink.getcode () == 404:
|
if permalink.status_code==404:
|
||||||
permalink.close ()
|
raise TypeError('%r is not a valid URL' % permalink.url)
|
||||||
raise TypeError('%r is not a valid URL' % url)
|
|
||||||
else:
|
else:
|
||||||
resolved_url = permalink.geturl ()
|
resolved_url = permalink.url
|
||||||
permalink.close ()
|
with requests.get(resolved_url) as track_url:
|
||||||
track_url = urllib.urlopen (resolved_url)
|
track_data = track_url.json()
|
||||||
track_data = json.loads (track_url.read ())
|
|
||||||
track_url.close ()
|
|
||||||
if track_data ['streamable']:
|
if track_data ['streamable']:
|
||||||
return track_data ['stream_url'] + "?client_id=%s" %client_id
|
return track_data ['stream_url'] + "?client_id=%s" %client_id
|
||||||
else:
|
else:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import time
|
import time
|
||||||
import platform
|
import platform
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
@ -17,7 +17,7 @@ import config
|
|||||||
import sound
|
import sound
|
||||||
import languageHandler
|
import languageHandler
|
||||||
import logging
|
import logging
|
||||||
import youtube_utils
|
from audio_services import youtube_utils
|
||||||
from controller.buffers import baseBuffers
|
from controller.buffers import baseBuffers
|
||||||
from sessions.twitter import compose, utils
|
from sessions.twitter import compose, utils
|
||||||
from mysc.thread_utils import call_threaded
|
from mysc.thread_utils import call_threaded
|
||||||
|
@ -4,7 +4,7 @@ import platform
|
|||||||
system = platform.system()
|
system = platform.system()
|
||||||
import application
|
import application
|
||||||
import requests
|
import requests
|
||||||
import youtube_utils
|
from audio_services import youtube_utils
|
||||||
import arrow
|
import arrow
|
||||||
if system == "Windows":
|
if system == "Windows":
|
||||||
from update import updater
|
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 paths
|
||||||
import sound_lib
|
import sound_lib
|
||||||
import output
|
import output
|
||||||
import youtube_utils
|
from audio_services import youtube_utils
|
||||||
import application
|
import application
|
||||||
system = platform.system()
|
system = platform.system()
|
||||||
if system=="Windows" and not hasattr(sys, 'frozen'): # We are running from source on Windows
|
if system=="Windows" and not hasattr(sys, 'frozen'): # We are running from source on Windows
|
||||||
|
Loading…
Reference in New Issue
Block a user