Example #1
0
def stopped(offset):
    kodi = Kodi(config, context)
    playlist_queue = music.MusicPlayer(kodi)

    playlist_queue.current_offset = offset
    playlist_queue.save_to_mongo()
    log.info('Streaming stopped')
Example #2
0
  def decorated_function(*args, **kwargs):
    kodi = Kodi(config, context)

    if kodi.config_error:
      response_text = render_template('config_missing').encode('utf-8')

      card_title = render_template('card_config_missing').encode('utf-8')
      return statement(response_text).simple_card(card_title, response_text)

    CAN_STREAM = music.has_music_functionality(kodi)

    if not CAN_STREAM:
      response_text = render_template('config_missing').encode("utf-8")
      return statement(response_text)

    # Since we're not getting any of the actual args passed in, we have to create them here
    slots = request.get('intent', {}).get('slots', {})
    for key, value in slots.iteritems():
      kwargs.update({key: value.get('value')})
    kwargs.update({'kodi': kodi})

    return f(*args, **kwargs)
Example #3
0
def play_back_finished():
    kodi = Kodi(config, context)
    playlist_queue = music.MusicPlayer(kodi)

    if playlist_queue.next_item:
        playlist_queue.skip_song()
Example #4
0
def nearly_finished():
    kodi = Kodi(config, context)
    playlist_queue = music.MusicPlayer(kodi)

    if playlist_queue.next_item:
        return audio().enqueue(playlist_queue.next_item)
Example #5
0
import re
import string
import random
import os
from kodi_voice import KodiConfigParser, Kodi

config_file = os.path.join(os.path.dirname(__file__), "kodi.config")
config = KodiConfigParser(config_file)

kodi = Kodi(config)


def most_words(l=[]):
    longest = 0
    for s in l:
        if len(s.split()) > longest:
            longest = len(s.split())
    return longest


def sort_by_words(l, longest):
    distributed = []
    for i in range(1, longest + 1):
        dl = [s for s in l if len(s.split()) == i]
        if dl:
            distributed.append(dl)
    return distributed


def clean_results(resp, cat, key, limit=None):
    if not limit:
Example #6
0
import re
import string
import random
import os
from kodi_voice import KodiConfigParser, Kodi

config_file = os.path.join(os.path.dirname(__file__), "kodi.config")
config = KodiConfigParser(config_file)

kodi = Kodi(config)


def most_words(l=[]):
  longest = 0
  for s in l:
    if len(s.split()) > longest:
      longest = len(s.split())
  return longest


def sort_by_words(l, longest):
  distributed = []
  for i in range(1, longest + 1):
    dl = [s for s in l if len(s.split()) == i]
    if dl:
      distributed.append(dl)
  return distributed


def clean_results(resp, cat, key, limit=None):
  if not limit:
Example #7
0
import re
import string
import random
import os
from kodi_voice import KodiConfigParser, Kodi

config_file = os.path.join(os.path.dirname(__file__), "kodi.config")
config = KodiConfigParser(config_file)

kodi = Kodi(config)


def most_words(l=[]):
    longest = 0
    for s in l:
        if len(s.split()) > longest:
            longest = len(s.split())
    return longest


def sort_by_words(l, longest):
    distributed = []
    for i in range(1, longest + 1):
        dl = [s for s in l if len(s.split()) == i]
        if dl:
            distributed.append(dl)
    return distributed


def clean_results(resp, cat, key, limit=None):
    if not limit:
import re
import string
import random
import os
from kodi_voice import KodiConfigParser, Kodi

config_file = os.path.join(os.path.dirname(__file__), "kodi.config")
config = KodiConfigParser(config_file)

kodi = Kodi(config)

# Generate MUSICARTISTS Slot
retrieved = kodi.GetMusicArtists()

all = []

if 'result' in retrieved and 'artists' in retrieved['result']:
    for v in retrieved['result']['artists']:
        name = kodi.sanitize_name(v['artist'], normalize=False)
        name_stripped = kodi.sanitize_name(v['artist'], True, False)
        all.append(name)
        all.append(name_stripped)

cleaned = list(set(all))
cleaned = filter(None, cleaned)
random.shuffle(cleaned)
cleaned = cleaned[:300]

gfile = open('MUSICARTISTS', 'w')
for a in cleaned:
    gfile.write("%s\n" % a.encode("utf-8"))
import re
import string
import random
import os
from kodi_voice import KodiConfigParser, Kodi

config_file = os.path.join(os.path.dirname(__file__), "kodi.config")
config = KodiConfigParser(config_file)

kodi = Kodi(config)


def most_words(l=[]):
    longest = 0
    for s in l:
        if len(s.split()) > longest:
            longest = len(s.split())
    return longest


def sort_by_words(l, longest):
    distributed = []
    for i in range(1, longest + 1):
        dl = [s for s in l if len(s.split()) == i]
        if len(dl) > 0:
            distributed.append(dl)
    return distributed


def clean_results(resp, cat, key, limit=100):
    cleaned = []