Additions to make code more compatible for py2 and py3
This commit is contained in:
parent
20942dedd9
commit
b47d6efe45
@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
""" main controller for MusicDL"""
|
""" main controller for MusicDL"""
|
||||||
|
from __future__ import unicode_literals # at top of module
|
||||||
import webbrowser
|
import webbrowser
|
||||||
import wx
|
import wx
|
||||||
import logging
|
import logging
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals # at top of module
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import vlc
|
import vlc
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: UTF-8 -*-
|
# -*- coding: UTF-8 -*-
|
||||||
|
from __future__ import unicode_literals # at top of module
|
||||||
|
|
||||||
class song(object):
|
class song(object):
|
||||||
""" Represents a song in all services. Data will be filled by the service itself"""
|
""" Represents a song in all services. Data will be filled by the service itself"""
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: UTF-8 -*-
|
# -*- coding: UTF-8 -*-
|
||||||
import urllib.parse
|
from __future__ import unicode_literals # at top of module
|
||||||
|
try:
|
||||||
|
import urllib.parse as urlparse
|
||||||
|
except ImportError:
|
||||||
|
import urllib as urlparse
|
||||||
import requests
|
import requests
|
||||||
import youtube_dl
|
import youtube_dl
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
@ -25,7 +29,7 @@ class interface(object):
|
|||||||
s.title = data[0].text.replace("\n", "").replace("\t", "")
|
s.title = data[0].text.replace("\n", "").replace("\t", "")
|
||||||
# s.artist = data[1].text.replace("\n", "").replace("\t", "")
|
# s.artist = data[1].text.replace("\n", "").replace("\t", "")
|
||||||
# print(data)
|
# print(data)
|
||||||
s.url = u"https://my.mail.ru"+urllib.parse.quote(data[0].__dict__["attrs"]["href"])
|
s.url = u"https://my.mail.ru"+urlparse.quote(data[0].__dict__["attrs"]["href"])
|
||||||
self.results.append(s)
|
self.results.append(s)
|
||||||
|
|
||||||
def get_download_url(self, url):
|
def get_download_url(self, url):
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals # at top of module
|
||||||
import requests
|
import requests
|
||||||
from .import baseFile
|
from .import baseFile
|
||||||
from update.utils import seconds_to_string
|
from update.utils import seconds_to_string
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals # at top of module
|
||||||
import isodate
|
import isodate
|
||||||
import youtube_dl
|
import youtube_dl
|
||||||
from googleapiclient.discovery import build
|
from googleapiclient.discovery import build
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: UTF-8 -*-
|
# -*- coding: UTF-8 -*-
|
||||||
|
from __future__ import unicode_literals # at top of module
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
import requests
|
import requests
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals # at top of module
|
||||||
|
import sys
|
||||||
|
if sys.version[0] == "2":
|
||||||
|
import fixes
|
||||||
|
fixes.setup()
|
||||||
import i18n
|
import i18n
|
||||||
i18n.setup()
|
i18n.setup()
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals # at top of module
|
||||||
import wx
|
import wx
|
||||||
import application
|
import application
|
||||||
from .import utils
|
from .import utils
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals # at top of module
|
||||||
import wx
|
import wx
|
||||||
|
try:
|
||||||
import wx.adv
|
import wx.adv
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
import application
|
import application
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
|
|
||||||
@ -77,7 +81,10 @@ class mainWindow(wx.Frame):
|
|||||||
self.sb.SetStatusText(status)
|
self.sb.SetStatusText(status)
|
||||||
|
|
||||||
def about_dialog(self, *args, **kwargs):
|
def about_dialog(self, *args, **kwargs):
|
||||||
|
try:
|
||||||
info = wx.adv.AboutDialogInfo()
|
info = wx.adv.AboutDialogInfo()
|
||||||
|
except:
|
||||||
|
info = wx.AboutDialogInfo()
|
||||||
info.SetName(application.name)
|
info.SetName(application.name)
|
||||||
info.SetVersion(application.version)
|
info.SetVersion(application.version)
|
||||||
info.SetDescription(application.description)
|
info.SetDescription(application.description)
|
||||||
@ -86,7 +93,10 @@ class mainWindow(wx.Frame):
|
|||||||
info.SetTranslators(application.translators)
|
info.SetTranslators(application.translators)
|
||||||
# info.SetLicence(application.licence)
|
# info.SetLicence(application.licence)
|
||||||
info.AddDeveloper(application.author)
|
info.AddDeveloper(application.author)
|
||||||
|
try:
|
||||||
wx.adv.AboutBox(info)
|
wx.adv.AboutBox(info)
|
||||||
|
except:
|
||||||
|
wx.AboutBox(info)
|
||||||
|
|
||||||
def get_text(self):
|
def get_text(self):
|
||||||
t = self.text.GetValue()
|
t = self.text.GetValue()
|
||||||
@ -103,5 +113,8 @@ class mainWindow(wx.Frame):
|
|||||||
saveFileDialog.Destroy()
|
saveFileDialog.Destroy()
|
||||||
|
|
||||||
def notify(self, title, text):
|
def notify(self, title, text):
|
||||||
|
try:
|
||||||
self.notification = wx.adv.NotificationMessage(title, text, parent=self)
|
self.notification = wx.adv.NotificationMessage(title, text, parent=self)
|
||||||
|
except AttributeError:
|
||||||
|
self.notification = wx.NotificationMessage(title, text, parent=self)
|
||||||
self.notification.Show()
|
self.notification.Show()
|
Loading…
Reference in New Issue
Block a user