Skip to content

Commit

Permalink
replace implicit relative imports with absolute ones -> fix setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Falk committed Oct 16, 2015
1 parent 1cbdf75 commit 5e70b0f
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 47 deletions.
3 changes: 3 additions & 0 deletions blockify/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env python3
from blockify.gui import main
main()
2 changes: 1 addition & 1 deletion blockify/blocklist.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
import os

import util
from blockify import util


log = logging.getLogger("list")
Expand Down
27 changes: 13 additions & 14 deletions blockify/blockify.py → blockify/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,21 @@
import subprocess
import sys
import time
import blockifydbus
import blocklist
import util
from gi import require_version

from gi import require_version
require_version('Gtk', '3.0')
require_version('Wnck', '3.0')

from gi.repository import Gtk
from gi.repository import Wnck

from gi.repository import GObject

log = logging.getLogger("main")
from blockify import dbusclient
from blockify import blocklist
from blockify import interludeplayer
from blockify import util


log = logging.getLogger("cli")


class Blockify(object):
Expand Down Expand Up @@ -62,7 +63,7 @@ def __init__(self, blocklist):
# The gst library used by interludeplayer for some reason modifies
# argv, overwriting some of docopts functionality in the process,
# so we import gst here, where docopts cannot be broken anymore.
import interludeplayer
#import interludeplayer
self.player = interludeplayer.InterludePlayer(self)

self.initialize_mute_method()
Expand Down Expand Up @@ -185,7 +186,7 @@ def init_channels(self):

def init_dbus(self):
try:
return blockifydbus.BlockifyDBus()
return dbusclient.DBusClient()
except Exception as e:
log.error("Cannot connect to DBus. Exiting.\n ({}).".format(e))
sys.exit()
Expand Down Expand Up @@ -581,15 +582,13 @@ def autodetect(self, boolean):
def initialize(doc=__doc__):
util.initialize(doc)

blockify = Blockify(blocklist.Blocklist())

return blockify
return Blockify(blocklist.Blocklist())


def main():
"Entry point for the CLI-version of Blockify."
blockify = initialize()
blockify.start()
cli = initialize()
cli.start()


if __name__ == "__main__":
Expand Down
16 changes: 8 additions & 8 deletions blockify/blockifydbus.py → blockify/dbusclient.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
#!/usr/bin/env python3
"""blockifydbus
"""dbusclient
Usage:
blockifydbus (toggle | next | prev | stop | play | pause) [-v...] [options]
blockifydbus get [title | artist | length | status | all] [-v...] [options]
blockifydbus (openuri <uri> | seek <secs> | setpos <pos>) [-v...] [options]
dbusclient (toggle | next | prev | stop | play | pause) [-v...] [options]
dbusclient get [title | artist | length | status | all] [-v...] [options]
dbusclient (openuri <uri> | seek <secs> | setpos <pos>) [-v...] [options]
Options:
-l, --log=<path> Enables logging to the logfile/-path specified.
-q, --quiet Don't print anything to stdout.
-v Verbosity of the logging module, up to -vvv.
-h, --help Show this help text.
--version Show current version of blockifydbus.
--version Show current version of dbusclient.
"""
import logging
import re

import dbus

import util
from blockify import util


log = logging.getLogger("dbus")
Expand All @@ -30,7 +30,7 @@
log.error("ImportError: Please install docopt to use the DBus CLI.")


class BlockifyDBus(object):
class DBusClient(object):
"Wrapper for Spotify's DBus interface."

def __init__(self, bus=None):
Expand Down Expand Up @@ -230,7 +230,7 @@ def main():
"Entry point for the CLI DBus interface."
args = docopt(__doc__, version="0.2")
util.init_logger(args["--log"], args["-v"], args["--quiet"])
dbus = BlockifyDBus()
dbus = DBusClient()

if args["toggle"]:
dbus.playpause()
Expand Down
11 changes: 4 additions & 7 deletions blockify/blockifyui.py → blockify/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,15 @@
import signal
import urllib.request

import blockify
from gi import require_version

require_version('Gtk', '3.0')

from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
from gi.repository import GObject

import util

from blockify import cli
from blockify import util

log = logging.getLogger("gui")

Expand Down Expand Up @@ -955,8 +952,8 @@ def on_exit_btn(self, widget):

def main():
"Entry point for the GUI-version of Blockify."
blockifyUI = BlockifyUI(blockify.initialize(__doc__))
blockifyUI.start()
gui = BlockifyUI(cli.initialize(__doc__))
gui.start()


if __name__ == "__main__":
Expand Down
3 changes: 2 additions & 1 deletion blockify/interludeplayer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import os
import random
import re
import urllib

Expand All @@ -11,7 +12,7 @@

from gi.repository import Gst
from gi.repository import Gtk
import random

from blockify import util


Expand Down
28 changes: 12 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
from os.path import dirname, join
from blockify.util import VERSION

try:
from setuptools import setup
except ImportError:
from distutils.core import setup

from setuptools import setup, find_packages

def read(filename):
with open(join(dirname(__file__), filename)) as f:
Expand All @@ -17,18 +13,18 @@ def read(filename):


setup(
name=_name,
description="Mute spotify advertisements.",
long_description=read("README.md"),
version=VERSION,
license=_license,
url="https://github.com/mikar/{}".format(_name),
author="Max Demian",
author_email="[email protected]",
packages=[_name, _name + "/data"],
package_data={_name + "/data": ["icon-*", "example_*"]},
name = _name,
description = "Mute spotify advertisements.",
long_description = read("README.md"),
version = VERSION,
license = _license,
url = "https://github.com/mikar/{}".format(_name),
author = "Max Falk",
author_email = "[email protected]",
packages = find_packages(),
package_data = { _name : ['data/*']},
install_package_data=True,
entry_points={
entry_points= {
"console_scripts": [
"{0} = {0}.{0}:main".format(_name),
"{0}-dbus = {0}.{0}dbus:main".format(_name),
Expand Down

0 comments on commit 5e70b0f

Please sign in to comment.