Beispiel #1
0
    def do_filter(self, mf=None):
        mf = mf if mf is not None else mfilter.Filter()
        if mf.name:
            kwargs = self.filter(mf.name)
            print(kwargs)
            mf = mfilter.Filter(**kwargs)

        query = f"""
        {{
            doFilter({mf.to_graphql()})
            {{
                nodes
                {{
                    title,
                    album,
                    genre,
                    artist,
                    folder,
                    youtube,
                    spotify,
                    number,
                    path,
                    rating,
                    duration,
                    size,
                    keywords
                }}
            }}
        }}"""
        return self._post(query)['data']['doFilter']['nodes']
Beispiel #2
0
 def playlist(self, mf=None):
     mf = mf if mf is not None else mfilter.Filter()
     query = f"""
     {{
         playlist({mf.to_graphql()})
     }}"""
     return self._post(query)['data']['playlist']
Beispiel #3
0
 def filters(self):
     default_filter = mfilter.Filter()
     filter_members = ','.join(default_filter.ordered_dict().keys())
     query = f"""
     {{
         filtersList
         {{
             name,
             {filter_members}
         }}
     }}"""
     return self._post(query)['data']['filtersList']
Beispiel #4
0
 def filter(self, name):
     default_filter = mfilter.Filter()
     filter_members = ','.join(default_filter.ordered_dict().keys())
     query = f"""
     {{
         filtersList(filter: {{name: {{equalTo: "{name}"}}}})
         {{
             name,
             {filter_members}
         }}
     }}"""
     return self._post(query)['data']['filtersList'][0]
Beispiel #5
0
 def bests(self, mf=None):
     mf = mf if mf is not None else mfilter.Filter()
     query = f"""
     {{
         bests({mf.to_graphql()})
         {{
             nodes
             {{
                 name,
                 content
             }}
         }}
     }}"""
     return self._post(query)['data']['bests']['nodes']
Beispiel #6
0
 def do_stat(self, mf=None):
     mf = mf if mf is not None else mfilter.Filter()
     query = f"""
     {{
         doStat({mf.to_graphql()})
         {{
           musics,
           artists,
           albums,
           genres,
           keywords,
           size,
           duration
         }}
     }}"""
     return self._post(query)['data']['doStat']