Created
April 26, 2011 19:14
-
-
Save homoludens/942884 to your computer and use it in GitHub Desktop.
patch so that brepodder behaves on frist start and create db and directories
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
diff --git a/Ui_mainwindow.py b/Ui_mainwindow.py | |
index 995c127..bab1da9 100644 | |
--- a/Ui_mainwindow.py | |
+++ b/Ui_mainwindow.py | |
@@ -18,7 +18,7 @@ import feedparser | |
from audioplayer import AudioPlayer | |
#setup_all() | |
-sys.setappdefaultencoding('utf-8') | |
+#sys.setappdefaultencoding('utf-8') | |
# constants | |
draggable = QtCore.Qt.ItemIsDragEnabled | |
diff --git a/audioplayer.py b/audioplayer.py | |
index f87a4ce..204f40e 100644 | |
--- a/audioplayer.py | |
+++ b/audioplayer.py | |
@@ -43,7 +43,7 @@ class AudioPlayer(QtGui.QWidget): | |
self.setUrl("http://www.jplayer.org/audio/ogg/Miaow-07-Bubble.ogg") | |
def setUrl(self, url): | |
- print url | |
+ #print url | |
self.player.setCurrentSource( Phonon.MediaSource(url) ); | |
diff --git a/brePodder.py b/brePodder.py | |
index dcdb1f6..b49066e 100644 | |
--- a/brePodder.py | |
+++ b/brePodder.py | |
@@ -214,7 +214,9 @@ class BrePodder(MainUi): | |
e = self.db.getEpisodeByTitle( episodeTitle ) | |
channel = self.db.getChannelById( e.get("channel_id") ) | |
ChannelDir = self.p.sub("", channel.get("title") ) | |
- | |
+ print "ChannelDir: " | |
+ print ChannelDir | |
+ | |
os.chdir(os.path.expanduser('~')+'/.brePodder/'+ChannelDir) | |
item = QtGui.QTreeWidgetItem(self.treeWidget) | |
item.setText(0, channel.get("title") ) | |
@@ -245,6 +247,8 @@ class BrePodder(MainUi): | |
def AddChannel(self, newUrl = None): | |
import feedparser | |
+ os.chdir( os.path.expanduser('~')+'/.brePodder' ) | |
+ | |
if newUrl == None: | |
feedLink = self.QLineEdit1.text().toUtf8().data() | |
else: | |
@@ -260,6 +264,9 @@ class BrePodder(MainUi): | |
# p=re.compile("\W") | |
ChannelDir = self.p.sub("",ChannelTitle) | |
+ print "ChannelDir: " | |
+ print ChannelDir | |
+ print os.getcwd() | |
try: | |
os.mkdir(ChannelDir) | |
except: | |
diff --git a/main.py b/main.py | |
index 748594d..e9a98f3 100644 | |
--- a/main.py | |
+++ b/main.py | |
@@ -15,11 +15,13 @@ from brePodder import * | |
if __name__ == "__main__": | |
os.chdir(os.path.expanduser('~')) | |
- | |
+ | |
+ print "marko" | |
if not os.path.isdir('.brePodder'): | |
+ print os.getcwd() | |
os.makedirs('.brePodder') | |
- os.chdir('.brePodder') | |
+ os.chdir('~/.brePodder') | |
# os.makedirs('images') | |
app = QtGui.QApplication(sys.argv) | |
MainWindow = QtGui.QMainWindow() | |
diff --git a/sql.py b/sql.py | |
index 33c057c..145406f 100644 | |
--- a/sql.py | |
+++ b/sql.py | |
@@ -3,7 +3,7 @@ | |
import sys | |
import sqlite3, os | |
-sys.setappdefaultencoding('utf-8') | |
+#sys.setappdefaultencoding('utf-8') | |
#metadata.bind = "sqlite:////home/homoludens/.brePodder/podcasts.sqlite" | |
@@ -224,7 +224,7 @@ class DBOperation(): | |
PRIMARY KEY (id) | |
)''') | |
con.commit() | |
- cur.close() | |
+ # cur.close() | |
except sqlite3.OperationalError: | |
print("table sql_channel already exists".format(self.table)) | |
@@ -244,7 +244,7 @@ class DBOperation(): | |
)''') | |
con.commit() | |
- cur.close() | |
+ #cur.close() | |
except sqlite3.OperationalError: | |
print("table sql_channels already exists".format(self.table)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment