mirror of
https://github.com/nova-r/fediplug.git
synced 2025-03-10 15:49:00 +01:00
remove dead code (#21)
Co-authored-by: Mæve Rey <42996147+m-rey@users.noreply.github.com>
This commit is contained in:
parent
e32a092e6a
commit
be11f68887
5 changed files with 1 additions and 96 deletions
|
@ -1,3 +1,3 @@
|
|||
'''A Mastodon client that automatically plays your friends' music as they toot links to it.'''
|
||||
'''A Mastodon client that automatically vibrates your buttplug.io devices as people on your timeline toot instructions.'''
|
||||
|
||||
from fediplug.cli import cli
|
||||
|
|
|
@ -6,11 +6,7 @@ import os
|
|||
path = os.path
|
||||
import sys
|
||||
|
||||
import atexit
|
||||
import appdirs
|
||||
import click as click
|
||||
import atexit
|
||||
from mastodon import Mastodon
|
||||
import asyncio
|
||||
|
||||
from fediplug.dirs import DIRS
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
import os
|
||||
path = os.path
|
||||
|
||||
import appdirs
|
||||
import click
|
||||
from keyring import get_password, set_password
|
||||
|
||||
|
|
|
@ -2,19 +2,15 @@
|
|||
|
||||
LISTEN_TO_HASHTAG = 'fediplug'
|
||||
|
||||
from os import umask
|
||||
|
||||
import click
|
||||
import lxml.html as lh
|
||||
from lxml.html.clean import clean_html
|
||||
import mastodon
|
||||
import asyncio
|
||||
import re
|
||||
from itertools import cycle
|
||||
|
||||
from fediplug.cli import options
|
||||
import fediplug.keyring as keyring
|
||||
from fediplug.queue import Queue
|
||||
from fediplug.buttplugio import trigger_actuators
|
||||
|
||||
Mastodon = mastodon.Mastodon
|
||||
|
@ -78,19 +74,6 @@ class StreamListener(mastodon.StreamListener):
|
|||
click.echo(f'queueing instructions {buttplug_instruction}')
|
||||
self.event_loop.run_until_complete(trigger_actuators(self.plug_client, buttplug_instruction))
|
||||
|
||||
'''
|
||||
if options['debug']:
|
||||
print(rf'instructions: {buttplug_instructions}')
|
||||
|
||||
for link in links:
|
||||
try:
|
||||
click.echo(rf'==> Trying {link}')
|
||||
self.queue.add(link)
|
||||
return
|
||||
except DownloadError:
|
||||
pass
|
||||
'''
|
||||
|
||||
def register(instance):
|
||||
'''Register fediplug to a Mastodon server and save the client credentials.'''
|
||||
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
'''The play queue.'''
|
||||
|
||||
from os import path, listdir, makedirs, remove, utime
|
||||
from time import time, localtime
|
||||
from threading import Thread, Lock
|
||||
|
||||
import click
|
||||
import asyncio
|
||||
|
||||
from fediplug.cli import options
|
||||
import fediplug.buttplugio as buttplugio
|
||||
|
||||
|
||||
|
||||
|
||||
'''--deprecated--'''
|
||||
class Queue(object):
|
||||
'''The play queue.'''
|
||||
|
||||
# pylint: disable=too-few-public-methods
|
||||
|
||||
def __init__(self, plug_client):
|
||||
self.lock = Lock()
|
||||
self.playing = False
|
||||
self.queue = []
|
||||
self.plug_client = plug_client
|
||||
|
||||
def add(self, buttplug_instructions):
|
||||
'''adds the buttplug instructions to the play queue.'''
|
||||
|
||||
with self.lock:
|
||||
self.queue.extend(buttplug_instructions)
|
||||
if not self.playing:
|
||||
self._play(self.queue.pop(0), self._play_finished)
|
||||
|
||||
def _play(self, buttplug_instructions, cb_complete):
|
||||
self.playing = True
|
||||
|
||||
def _run_thread(buttplug_instructions, cb_complete):
|
||||
play_command = build_play_command(buttplug_instructions)
|
||||
if options['debug']:
|
||||
click.echo(f'==> Playing {buttplug_instructions} with {play_command}')
|
||||
else:
|
||||
click.echo(f'==> Playing {buttplug_instructions}')
|
||||
"""
|
||||
loop = asyncio.new_event_loop
|
||||
asyncio.run_coroutine_threadsafe(buttplugio.trigger_actuators(self.plug_client, play_command), loop)
|
||||
# run command THIS DOES NOT WORK RIGHT NOW ##### THIS REALLY NEEDS TO BE FIXED
|
||||
#loop = asyncio.events._get_running_loop()
|
||||
#print(loop) """
|
||||
|
||||
print('foo')
|
||||
|
||||
click.echo('==> Playback complete')
|
||||
cb_complete()
|
||||
|
||||
thread = Thread(target=_run_thread, args=(buttplug_instructions, cb_complete))
|
||||
thread.start()
|
||||
|
||||
|
||||
def _play_finished(self):
|
||||
with self.lock:
|
||||
self.playing = False
|
||||
if self.queue:
|
||||
self._play(self.queue.pop(0), self._play_finished)
|
||||
|
||||
|
||||
def build_play_command(buttplug_instructions):
|
||||
'''Builds a play command for the given filename.'''
|
||||
# hardcoded for now
|
||||
# return tuple with ( strength [0.0-1.0] , duration [in s] )
|
||||
|
||||
return (0.5, 1)
|
Loading…
Reference in a new issue