Skip to content

user.py

ListUser (ListViewItem)

Describes a user

Source code in mps_youtube/listview/user.py
class ListUser(ListViewItem):
    """ Describes a user
    """
    # pylint: disable=unused-argument
    def id(self, length=0):
        """ Returns YTID """
        return self.data.get("id")

    def name(self, length=10):
        """ Returns channel name """
        return u.uea_pad(length, self.data.get("title"))

    def description(self, length=10):
        """ Channel description"""
        return u.uea_pad(length, self.data["descriptionSnippet"][0]['text'] if self.data['descriptionSnippet'] is not None else 'No description found')

    def kind(self, length=10):
        """ Returns the youtube datatype
            Example: youtube#channel, youtube#video
        """
        return self.data.get("type")

    def ret(self):
        """ Used in the ListView play function """
        return (self.name(), self.id(), "")

    @staticmethod
    def return_field():
        """ Determines which function will be called on selected items """
        return "ret"

description(self, length=10)

Channel description

Source code in mps_youtube/listview/user.py
def description(self, length=10):
    """ Channel description"""
    return u.uea_pad(length, self.data["descriptionSnippet"][0]['text'] if self.data['descriptionSnippet'] is not None else 'No description found')

id(self, length=0)

Returns YTID

Source code in mps_youtube/listview/user.py
def id(self, length=0):
    """ Returns YTID """
    return self.data.get("id")

kind(self, length=10)

Returns the youtube datatype Example: youtube#channel, youtube#video

Source code in mps_youtube/listview/user.py
def kind(self, length=10):
    """ Returns the youtube datatype
        Example: youtube#channel, youtube#video
    """
    return self.data.get("type")

name(self, length=10)

Returns channel name

Source code in mps_youtube/listview/user.py
def name(self, length=10):
    """ Returns channel name """
    return u.uea_pad(length, self.data.get("title"))

ret(self)

Used in the ListView play function

Source code in mps_youtube/listview/user.py
def ret(self):
    """ Used in the ListView play function """
    return (self.name(), self.id(), "")

return_field() staticmethod

Determines which function will be called on selected items

Source code in mps_youtube/listview/user.py
@staticmethod
def return_field():
    """ Determines which function will be called on selected items """
    return "ret"