コード例 #1
0
ファイル: playonefm.py プロジェクト: uxlsl/uxlsl.github.io
def main():
    import sys
    # 4 是粤语
    channel = int(sys.argv[1])
    playlist = Playlist()
    playlist.set_channel(channel)
    mplayer = player.MPlayer()
    mplayer.start_queue(playlist)

    while True:
        if not mplayer.is_alive:
            break
        time.sleep(5)
コード例 #2
0
ファイル: data.py プロジェクト: ChenghaoQ/Pyex
	def __init__(self):
		self.playlist = Playlist()
		self.lines = Channel().lines
		self.keys = db_config.keys
		self.volume = db_config.volume
		self.user_name = db_config.ser_name

		self.netease = db_config.netease
		self.song_like = False
		self.pause = False
		self.loop = False
		self.pro = False
		self.pro = False
		self.mute = False
		self.time = 0
コード例 #3
0
    def __init__(self):
        self.playlist = Playlist()
        self.lines = Channel().lines
        # self.hitory = History()
        self.keys = db_config.keys  # keys
        self.volume = db_config.volume  # 声量
        self.theme_id = db_config.theme_id  # 主题id
        self.channel = db_config.channel  # 当前频道
        self.user_name = db_config.user_name  # 用户名

        self.netease = db_config.netease  # 网易高品质音乐
        self.song_like = False  # 当前歌词是否like
        self.pause = False  # 歌曲暂停
        self.loop = False  # 单曲循环
        self.pro = False  # pro用户
        self.mute = False  # 静音
        self.time = 0  # 时间/秒
コード例 #4
0
ファイル: douban.py プロジェクト: whd910421/douban.fm
class Data(object):
    """
    所有需要的数据统一在一起
    """

    def __init__(self):
        self.playlist = Playlist()
        self.lines = Channel().lines
        # self.hitory = History()
        self.keys = db_config.keys  # keys
        self.volume = db_config.volume  # 声量
        self.theme_id = db_config.theme_id  # 主题id
        self.channel = db_config.channel  # 当前频道
        self.user_name = db_config.user_name  # 用户名

        self.song_like = False  # 当前歌词是否like
        self.loop = False  # 单曲循环
        self.pro = False  # pro用户
        self.mute = False  # 静音
        self.time = 0  # 时间/秒

    @property
    def theme(self):
        THEME = ['default', 'larapaste', 'monokai', 'tomorrow']
        return getattr(theme, THEME[self.theme_id])

    def set_theme_id(self, value):
        self.theme_id = value

    @property
    def lrc(self):
        return self.playlist.get_lrc()

    @property
    def playingsong(self):
        return self.playlist.get_playingsong()

    def get_song(self):
        playingsong = self.playlist.get_song()
        self.song_like = playingsong['like']
        return playingsong

    def set_song_like(self):
        self.song_like = True
        self.playlist.set_song_like()

    def set_song_unlike(self):
        self.song_like = False
        self.playlist.set_song_unlike()

    def change_volume(self, increment):
        """调整音量大小"""
        if increment == 1:
            self.volume += 5
        else:
            self.volume -= 5
        self.volume = max(min(self.volume, 100), 0)  # 限制在0-100之间

    def save(self):
        db_config.save_config(self.volume, self.channel, self.theme_id)
コード例 #5
0
ファイル: douban.py プロジェクト: whd910421/douban.fm
    def __init__(self):
        self.playlist = Playlist()
        self.lines = Channel().lines
        # self.hitory = History()
        self.keys = db_config.keys  # keys
        self.volume = db_config.volume  # 声量
        self.theme_id = db_config.theme_id  # 主题id
        self.channel = db_config.channel  # 当前频道
        self.user_name = db_config.user_name  # 用户名

        self.song_like = False  # 当前歌词是否like
        self.loop = False  # 单曲循环
        self.pro = False  # pro用户
        self.mute = False  # 静音
        self.time = 0  # 时间/秒
コード例 #6
0
ファイル: data.py プロジェクト: flashzs/douban.fm
class Data(object):
    """
    集合所有数据, 并提供方法
    所有外部接口都只会调用这个类/方法
    """

    def __init__(self):
        self.playlist = Playlist()
        self.lines = Channel().lines
        # self.hitory = History()
        self.keys = db_config.keys  # keys
        self.volume = db_config.volume  # 声量
        self.theme_id = db_config.theme_id  # 主题id
        self.channel = db_config.channel  # 当前频道
        self.user_name = db_config.user_name  # 用户名

        self.netease = db_config.netease  # 网易高品质音乐
        self.song_like = False  # 当前歌词是否like
        self.pause = False  # 歌曲暂停
        self.loop = False  # 单曲循环
        self.pro = False  # pro用户
        self.mute = False  # 静音
        self.time = 0  # 时间/秒

    @property
    def theme(self):
        THEME = ['default', 'larapaste', 'monokai', 'tomorrow']
        return getattr(theme, THEME[self.theme_id])

    def set_theme_id(self, value):
        self.theme_id = value

    @property
    def lrc(self):
        return self.playlist.get_lrc()

    @property
    def playingsong(self):
        return self.playlist.get_playingsong()

    def bye(self):
        self.playlist.bye()

    def get_song(self):
        playingsong = self.playlist.get_song(self.netease)
        self.song_like = playingsong['like']
        return playingsong

    def set_channel(self, channel_index):
        self.playlist.set_channel(channel_index)

    def set_song_like(self, playingsong):
        self.playlist.set_song_like(playingsong)

    def set_song_unlike(self, playingsong):
        self.playlist.set_song_unlike(playingsong)

    def submit_music(self, playingsong):
        self.playlist.submit_music(playingsong)

    def change_volume(self, increment):
        """调整音量大小"""
        if increment == 1:
            self.volume += 5
        else:
            self.volume -= 5
        self.volume = max(min(self.volume, 100), 0)  # 限制在0-100之间

    def save(self):
        db_config.save_config(self.volume,
                              self.channel,
                              self.theme_id,
                              self.netease)
コード例 #7
0
class Data(object):
    """
    集合所有数据, 并提供方法
    所有外部接口都只会调用这个类/方法
    """
    def __init__(self):
        self.playlist = Playlist()
        self.lines = Channel().lines
        # self.hitory = History()
        self.keys = db_config.keys  # keys
        self.volume = db_config.volume  # 声量
        self.theme_id = db_config.theme_id  # 主题id
        self.channel = db_config.channel  # 当前频道
        self.user_name = db_config.user_name  # 用户名

        self.netease = db_config.netease  # 网易高品质音乐
        self.song_like = False  # 当前歌词是否like
        self.pause = False  # 歌曲暂停
        self.loop = False  # 单曲循环
        self.pro = False  # pro用户
        self.mute = False  # 静音
        self.time = 0  # 时间/秒

    @property
    def theme(self):
        THEME = ['default', 'larapaste', 'monokai', 'tomorrow']
        return getattr(theme, THEME[self.theme_id])

    def set_theme_id(self, value):
        self.theme_id = value

    @property
    def lrc(self):
        return self.playlist.get_lrc()

    @property
    def playingsong(self):
        return self.playlist.get_playingsong()

    def bye(self):
        self.playlist.bye()

    def get_song(self):
        playingsong = self.playlist.get_song(self.netease)
        self.song_like = playingsong['like']
        return playingsong

    def set_channel(self, channel_index):
        self.playlist.set_channel(channel_index)

    def set_song_like(self, playingsong):
        self.playlist.set_song_like(playingsong)

    def set_song_unlike(self, playingsong):
        self.playlist.set_song_unlike(playingsong)

    def submit_music(self, playingsong):
        self.playlist.submit_music(playingsong)

    def change_volume(self, increment):
        """调整音量大小"""
        if increment == 1:
            self.volume += 5
        else:
            self.volume -= 5
        self.volume = max(min(self.volume, 100), 0)  # 限制在0-100之间

    def save(self):
        db_config.save_config(self.volume, self.channel, self.theme_id,
                              self.netease)
コード例 #8
0
ファイル: data.py プロジェクト: ChenghaoQ/Pyex
class Data(object):
	"""
	aggregate data and provide the method
	all external api will only use this class/method
	"""

	def __init__(self):
		self.playlist = Playlist()
		self.lines = Channel().lines
		self.keys = db_config.keys
		self.volume = db_config.volume
		self.user_name = db_config.ser_name

		self.netease = db_config.netease
		self.song_like = False
		self.pause = False
		self.loop = False
		self.pro = False
		self.pro = False
		self.mute = False
		self.time = 0

	@property ###where did this come from

	def theme(self):
		THEME = ['default','larapaste','monokai','tomorrow']
		return getattr(them,THEME[self.theme_id])#getattr?????/

	def set_theme_id(self,value):
		self.theme_id = value

	@property
	def lrc(self):
		return self.playlist.get_lrc()

	@property
	def playingsong(self):
		return self.playlist.get_playingsong()

	def bye(self):
		self.playlist.bye()
	
	def get_daily_song(self):
		return self.playlist.get_daily_song(self.netease)

	def get_song(self):
		playingsong = self.playlist.get_song(self.netease) if self.channel != 2 else self.get_daily_song()
		self.song_like = True if str(playingsong['like']) == '1' else False
		return playingsong

	def set_channel(self,channel_index):
		self.playlist.set_channel(channel_index)

	def set_channel(self,channel_index):
		self.playlist.set_channel(channel_index)

	def set_song_like(self,playingsong):
		self.playlist.set_song_like(playingsong)

	def set_song_unlike(self,playingsong):
		self.playlist.set_song_unlike(playingsong)

	def submit_music(self,playingsong):
		self.playlist.submit_music(playingsong)

	def change_volume(self,increment):
		if increment == 1:
			self.volume += 5
		else:
			self.volume -= 5  #the reason of -?

		self.volume = max(min(self.volume,100),0)####

	def save(self):
		db_config.save_config(self.volume,
					self.channel
					self.theme_id,
					self.netease)