Example #1
0
    def _on_search_results(self, button):
        get_type = self.get_selected_type()
        amount = self._scale.get_value()

        if self._current_query is not None:
            self._current_query.cancel()

        self._current_query = metadata.configure_query(
            get_type, amount=amount,
            artist=self._entry_map['artist'].get_text(),
            album=self._entry_map['album'].get_text(),
            title=self._entry_map['title'].get_text()
        )

        self._content_box.clear()
        self._search_button.progress = 0.1

        g.meta_retriever.push(
            self._current_query,
            self._on_search_finished,
            self._on_cache_retrieved
        )
Example #2
0
        overlay.add_overlay(control_box)

        self.pack_start(overlay, True, True, 0)
        self.set_size_request(100, 40)


if __name__ == '__main__':
    # Stdlib:
    import sys

    # Internal:
    from moosecat.gtk.runner import main
    from moosecat.metadata import configure_query

    with main(metadata=True) as win:
        qry1 = configure_query('cover', sys.argv[1], sys.argv[2])
        qry1.database = g.meta_retriever.database
        cache1 = qry1.commit()[0]

        qry2 = configure_query('lyrics', sys.argv[3], title=sys.argv[4])
        qry2.database = g.meta_retriever.database
        cache2 = qry2.commit()[0]

        qry3 = configure_query('tracklist', 'Metallica', 'Load', amount=20)
        qry3.database = g.meta_retriever.database
        cache3 = qry3.commit()

        box = Gtk.VBox()
        box.pack_start(TextTemplate(qry2, cache2), False, False, 0)
        box.pack_start(DottedSeparator(), False, False, 0)
        box.pack_start(CoverTemplate(qry1, cache1), False, False, 0)