diff --git a/Action.php b/Action.php index 7514bc0..46f0125 100644 --- a/Action.php +++ b/Action.php @@ -1,6 +1,6 @@ request->get('site'); $rate=Typecho_Widget::widget('Widget_Options')->plugin('Meting')->bitrate; - $cachekey="url/{$site}/{$id}"; + $cachekey="url/{$site}/{$id}/{$rate}"; $data=self::cacheRead($cachekey,60*15); if(!$data){ $data=(new Meting($site))->url($id,$rate); @@ -207,7 +208,7 @@ var Meting{$PID} = new APlayer({ $result = $db->fetchAll($query); if(sizeof($result)){ if(time()-$result[0]['date']>$t){ - $delete = $db->delete('value','date')->from($prefix.'meting')->where('datedelete($prefix.'meting')->where('datequery($delete); return false; } diff --git a/Plugin.php b/Plugin.php index 08765c2..749126c 100644 --- a/Plugin.php +++ b/Plugin.php @@ -2,17 +2,17 @@ if(!defined('__TYPECHO_ROOT_DIR__'))exit; /** - * Meting for Typecho + * Meting for Typecho | 在 Typecho 中使用 APlayer 播放在线音乐吧~ * * @package Meting * @author METO - * @version 1.0.1 + * @version 1.0.2 * @dependence 13.12.12-* * @link https://github.com/metowolf/Meting * */ - define('METING_VERSION','1.0.1'); + define('METING_VERSION','1.0.2'); class Meting_Plugin extends Typecho_Widget implements Typecho_Plugin_Interface { @@ -58,9 +58,9 @@ class Meting_Plugin extends Typecho_Widget implements Typecho_Plugin_Interface */ public static function config(Typecho_Widget_Helper_Form $form){ $t = new Typecho_Widget_Helper_Form_Element_Text( - 'theme', null, '#e9e9e9', + 'theme', null, '#ad7a86', _t('播放器颜色'), - _t('播放器默认的主题颜色,支持如 #372e21、#75c、red,该设定会被[Meting]标签中的theme属性覆盖,默认为 #e9e9e9')); + _t('播放器默认的主题颜色,支持如 #372e21、#75c、red,该设定会被[Meting]标签中的theme属性覆盖,默认为 #ad7a86')); $form->addInput($t); $t = new Typecho_Widget_Helper_Form_Element_Text( 'height', null, '340px', @@ -102,7 +102,12 @@ class Meting_Plugin extends Typecho_Widget implements Typecho_Plugin_Interface */ public static function header(){ $dir=Helper::options()->pluginUrl.'/Meting/assets/'; - echo "\n\n"; + $ver=METING_VERSION; + echo << + + +EOF; } public static function footer(){} @@ -154,7 +159,7 @@ EOF; echo << $(function() { - if($('#wmd-button-row').length>0)$('#wmd-button-row').append('
  • 音乐
  • '); + if($('#wmd-button-row').length>0)$('#wmd-button-row').append('
  • '); $(document).on('click', '#wmd-music-button', function() { $('body').append( '
    '+ @@ -286,7 +291,6 @@ EOF; } }catch(Typecho_Db_Exception $e){ $code=$e->getCode(); - if($code=='42S01')return; throw new Typecho_Plugin_Exception('数据表清空失败,插件禁用失败。错误号: '.$code); } } diff --git a/README.md b/README.md index f6e81d0..5f41075 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ 4. 后台启用插件 ## 使用 -在文章编辑页面,点击编辑器上的 **音乐** 按钮,在弹出的窗口中输入音乐地址(见支持列表),最后点击确定即可 +在文章编辑页面,点击编辑器上的 **音乐图标** 按钮,在弹出的窗口中输入音乐地址(见支持列表),最后点击确定即可 **歌曲混合特性:** 允许添加多个音乐地址,每行一个,插件会自动将所有歌曲合并在同一个歌单进行播放。 ## 支持列表 @@ -28,6 +28,7 @@ - 专辑 http://music.163.com/#/album?id=34808540 - 歌手 http://music.163.com/#/artist?id=3681 - 歌单 http://music.163.com/#/playlist?id=436843836 + - 榜单 http://music.163.com/#/discover/toplist?id=60198 QQ 音乐 http://y.qq.com - 单曲 https://y.qq.com/portal/song/000jDQWP4JiB3y.html diff --git a/include/Meting.php b/include/Meting.php index 2c1b214..1870eb6 100644 --- a/include/Meting.php +++ b/include/Meting.php @@ -44,7 +44,7 @@ class Meting } curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); curl_setopt($curl,CURLOPT_CONNECTTIMEOUT,10); - curl_setopt($curl,CURLOPT_TIMEOUT,10); + curl_setopt($curl,CURLOPT_TIMEOUT,20); curl_setopt($curl,CURLOPT_COOKIE,$BASE['cookie']); curl_setopt($curl,CURLOPT_REFERER,$BASE['referer']); curl_setopt($curl,CURLOPT_USERAGENT,$BASE['useragent']); @@ -854,14 +854,14 @@ class Meting private function format_kugou($data){ $result=array( 'id' => $data['hash'], - 'name' => "", + 'name' => $data['filename']?:$data['fileName'], 'artist' => array(), 'url_id' => $data['hash'], 'pic_id' => $data['hash'], 'lyric_id' => $data['hash'], 'source' => 'kugou', ); - list($result['artist'],$result['name'])=explode(' - ',$data['filename']?:$data['fileName']); + list($result['artist'],$result['name'])=explode(' - ',$result['name'],2); $result['artist']=explode('、',$result['artist']); return $result; }