├── .github ├── ISSUE_TEMPLATE │ ├── add_card.yml │ ├── add_source.yml │ ├── bug_report.yml │ ├── config.yml │ └── new_feature.yml └── workflows │ └── maven.yml ├── .gitignore ├── .project ├── .settings ├── net.sf.jautodoc.prefs └── org.eclipse.m2e.core.prefs ├── LICENSE ├── README.md ├── docs ├── allclasses-index.html ├── allpackages-index.html ├── com │ └── khjxiaogu │ │ └── MiraiSongPlugin │ │ ├── MiraiSongPlugin.html │ │ ├── MusicCardProvider.html │ │ ├── MusicInfo.html │ │ ├── MusicSource.html │ │ ├── NetEaseCrypto.html │ │ ├── PluginData.html │ │ ├── Utils.html │ │ ├── cardprovider │ │ ├── AmrVoiceProvider.html │ │ ├── LightAppCardProvider.html │ │ ├── LightAppXCardProvider.html │ │ ├── PlainMusicInfoProvider.html │ │ ├── ShareCardProvider.html │ │ ├── SilkVoiceProvider.html │ │ ├── XMLCardProvider.html │ │ ├── class-use │ │ │ ├── AmrVoiceProvider.html │ │ │ ├── LightAppCardProvider.html │ │ │ ├── LightAppXCardProvider.html │ │ │ ├── PlainMusicInfoProvider.html │ │ │ ├── ShareCardProvider.html │ │ │ ├── SilkVoiceProvider.html │ │ │ └── XMLCardProvider.html │ │ ├── package-summary.html │ │ ├── package-tree.html │ │ └── package-use.html │ │ ├── class-use │ │ ├── MiraiSongPlugin.html │ │ ├── MusicCardProvider.html │ │ ├── MusicInfo.html │ │ ├── MusicSource.html │ │ ├── NetEaseCrypto.html │ │ ├── PluginData.html │ │ └── Utils.html │ │ ├── musicsource │ │ ├── BaiduMusicSource.html │ │ ├── KugouMusicSource.html │ │ ├── NetEaseMusicSource.html │ │ ├── QQMusicHQSource.html │ │ ├── QQMusicSource.html │ │ ├── class-use │ │ │ ├── BaiduMusicSource.html │ │ │ ├── KugouMusicSource.html │ │ │ ├── NetEaseMusicSource.html │ │ │ ├── QQMusicHQSource.html │ │ │ └── QQMusicSource.html │ │ ├── package-summary.html │ │ ├── package-tree.html │ │ └── package-use.html │ │ ├── package-summary.html │ │ ├── package-tree.html │ │ ├── package-use.html │ │ └── test │ │ ├── Main.html │ │ ├── class-use │ │ └── Main.html │ │ ├── package-summary.html │ │ ├── package-tree.html │ │ └── package-use.html ├── constant-values.html ├── deprecated-list.html ├── element-list ├── help-doc.html ├── index-files │ ├── index-1.html │ ├── index-10.html │ ├── index-11.html │ ├── index-12.html │ ├── index-13.html │ ├── index-14.html │ ├── index-15.html │ ├── index-16.html │ ├── index-17.html │ ├── index-18.html │ ├── index-19.html │ ├── index-2.html │ ├── index-20.html │ ├── index-21.html │ ├── index-22.html │ ├── index-23.html │ ├── index-3.html │ ├── index-4.html │ ├── index-5.html │ ├── index-6.html │ ├── index-7.html │ ├── index-8.html │ └── index-9.html ├── index.html ├── jquery │ ├── external │ │ └── jquery │ │ │ └── jquery.js │ ├── images │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ ├── ui-bg_glass_65_dadada_1x400.png │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ ├── ui-bg_highlight-soft_75_cccccc_1x100.png │ │ ├── ui-icons_222222_256x240.png │ │ ├── ui-icons_2e83ff_256x240.png │ │ ├── ui-icons_454545_256x240.png │ │ ├── ui-icons_888888_256x240.png │ │ └── ui-icons_cd0a0a_256x240.png │ ├── jquery-3.3.1.js │ ├── jquery-migrate-3.0.1.js │ ├── jquery-ui.css │ ├── jquery-ui.js │ ├── jquery-ui.min.css │ ├── jquery-ui.min.js │ ├── jquery-ui.structure.css │ ├── jquery-ui.structure.min.css │ ├── jszip-utils │ │ └── dist │ │ │ ├── jszip-utils-ie.js │ │ │ ├── jszip-utils-ie.min.js │ │ │ ├── jszip-utils.js │ │ │ └── jszip-utils.min.js │ └── jszip │ │ └── dist │ │ ├── jszip.js │ │ └── jszip.min.js ├── member-search-index.js ├── member-search-index.zip ├── overview-summary.html ├── overview-tree.html ├── package-search-index.js ├── package-search-index.zip ├── resources │ ├── glass.png │ └── x.png ├── script.js ├── search.js ├── stylesheet.css ├── type-search-index.js └── type-search-index.zip ├── ffmpeg └── .gitignore ├── pom.xml ├── silk_v3_encoder.exe └── src ├── .gitignore └── main ├── java-templates └── com │ └── khjxiaogu │ └── MiraiSongPlugin │ └── PluginData.java ├── java └── com │ └── khjxiaogu │ └── MiraiSongPlugin │ ├── HttpRequestBuilder.java │ ├── JsonBuilder.java │ ├── MiraiSongPlugin.java │ ├── MusicCardProvider.java │ ├── MusicInfo.java │ ├── MusicSource.java │ ├── NetEaseCrypto.java │ ├── SongIdMatcher.java │ ├── Utils.java │ ├── cardprovider │ ├── AmrVoiceProvider.java │ ├── LightAppCardProvider.java │ ├── LightAppXCardProvider.java │ ├── MiraiMusicCard.java │ ├── PlainMusicInfoProvider.java │ ├── ShareCardProvider.java │ ├── SilkVoiceProvider.java │ └── XMLCardProvider.java │ ├── musicsource │ ├── BaiduMusicSource.java │ ├── BiliBiliMusicSource.java │ ├── KugouMusicSource.java │ ├── LocalFileSource.java │ ├── NetEaseAdvancedRadio.java │ ├── NetEaseHQMusicSource.java │ ├── NetEaseMusicSource.java │ ├── NetEaseRadioSource.java │ ├── QQMusicSource.java │ └── XimalayaSource.java │ └── permission │ ├── BotMatcher.java │ ├── CommandMatcher.java │ ├── FriendMatcher.java │ ├── GlobalMatcher.java │ ├── GroupMatcher.java │ ├── MatchInfo.java │ ├── Matchers.java │ ├── MemberPermissionMatcher.java │ ├── NullOperationMatcher.java │ ├── PermissionMatcher.java │ ├── PermissionResult.java │ ├── QQMatcher.java │ ├── StrangerMatcher.java │ └── WildcardPermission.java └── resources ├── META-INF └── services │ └── net.mamoe.mirai.console.plugin.jvm.JvmPlugin └── config.yml /.github/ISSUE_TEMPLATE/add_card.yml: -------------------------------------------------------------------------------- 1 | name: 添加音乐外观 2 | description: 为音乐分享添加外观 3 | title: "[添加外观]" 4 | labels: enhancement 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | 在反馈问题前,请确保本插件是在最新版。 10 | - type: textarea 11 | id: main_link 12 | attributes: 13 | label: 外观描述 14 | description: 这个外观是怎么样的,有哪些功能,配图 15 | validations: 16 | required: true 17 | - type: textarea 18 | id: why 19 | attributes: 20 | label: 为什么要添加这个外观 21 | description: 它有什么特别的功能目前其他外观不能实现? 22 | validations: 23 | required: true 24 | - type: textarea 25 | id: how 26 | attributes: 27 | label: 相关资料 28 | description: 这个外观的mirai码/分享方法/Mirai项目的相关文档 29 | validations: 30 | required: true 31 | - type: checkboxes 32 | attributes: 33 | label: 提交前我已确定: 34 | options: 35 | - label: 我已阅读README,没有发现对应内容。 36 | required: true 37 | - label: 我已在issue内搜索,没有发现已有的issue。 38 | required: true 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/add_source.yml: -------------------------------------------------------------------------------- 1 | name: 添加音乐来源 2 | description: 添加音乐来源api 3 | title: "[添加来源]" 4 | labels: enhancement 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | 在反馈问题前,请确保本插件是在最新版。 10 | - type: textarea 11 | id: main_link 12 | attributes: 13 | label: 音乐来源,官网链接 14 | description: 最好是提供API项目链接/API相关文章 15 | validations: 16 | required: true 17 | - type: textarea 18 | id: why 19 | attributes: 20 | label: 为什么要添加这个来源 21 | description: 它有什么独特之处或者独有版权? 22 | validations: 23 | required: true 24 | - type: checkboxes 25 | attributes: 26 | label: 提交前我已确定: 27 | options: 28 | - label: 我已阅读README,没有发现对应内容。 29 | required: true 30 | - label: 我已在issue内搜索,没有发现已有的issue。 31 | required: true 32 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: bug报告 2 | description: 提交bug报告 3 | title: "[Bug] " 4 | labels: problem, question 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | 在反馈问题前,请确保本插件是在最新版。 10 | 请认真填写每个项,乱写的会被直接关闭。 11 | - type: textarea 12 | id: error_behaviour 13 | attributes: 14 | label: 错误现像描述 15 | description: 详细描述错误的现像 16 | validations: 17 | required: true 18 | - type: textarea 19 | id: expected_behaviour 20 | attributes: 21 | label: 预计结果 22 | description: 你希望的修复后结果 23 | validations: 24 | required: true 25 | - type: textarea 26 | id: reproduction 27 | attributes: 28 | label: 重现步骤 29 | description: 列表展示发生bug的步骤 30 | placeholder: | 31 | 1. 设置配置为blablabla 32 | 2. 执行blablabla操作 33 | 3. 出现错误 34 | 4. ... 35 | validations: 36 | required: true 37 | - type: input 38 | id: crashlog 39 | attributes: 40 | label: 错误报告 41 | description: 贴出或者截图错误堆栈,也可以贴pastebin链接 42 | placeholder: https://paste.ubuntu.com/ 43 | - type: input 44 | id: plugin-version 45 | attributes: 46 | label: 插件版本 47 | placeholder: 1.0.0 48 | validations: 49 | required: true 50 | - type: input 51 | id: mirai-version 52 | attributes: 53 | label: mirai版本 54 | placeholder: 2.0.0 55 | validations: 56 | required: true 57 | - type: input 58 | id: system 59 | attributes: 60 | label: 系统信息 61 | placeholder: Windows Server 2020 62 | validations: 63 | required: true 64 | - type: textarea 65 | id: config 66 | attributes: 67 | label: 配置文件 68 | description: 如果是配置相关错误,请贴上你的配置文件。 69 | - type: checkboxes 70 | attributes: 71 | label: 提交前我已确定: 72 | options: 73 | - label: 我已阅读README,没有发现对应内容。 74 | required: true 75 | - label: 我已在issue内搜索,没有发现已有的issue。 76 | required: true 77 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/new_feature.yml: -------------------------------------------------------------------------------- 1 | name: 特性建议 2 | description: 建议添加新的功能/特性 3 | title: "[建议]" 4 | labels: enhancement 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | 在反馈问题前,请确保本插件是在最新版。 10 | - type: textarea 11 | id: main 12 | attributes: 13 | label: 建议功能描述 14 | description: 你希望有什么样的功能 15 | validations: 16 | required: true 17 | - type: textarea 18 | id: why 19 | attributes: 20 | label: 为什么要添加这个功能? 21 | description: 它能有什么作用? 22 | - type: textarea 23 | id: how 24 | attributes: 25 | label: 有相似功能的其他插件 26 | description: 如果有相似功能的其他插件,可以贴上项目代码。 27 | - type: checkboxes 28 | attributes: 29 | label: 提交前我已确定: 30 | options: 31 | - label: 我已阅读README,没有发现对应内容。 32 | required: true 33 | - label: 我已在issue内搜索,没有发现已有的issue。 34 | required: true 35 | -------------------------------------------------------------------------------- /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | name: Java CI with Maven 2 | 3 | on: 4 | [workflow_dispatch] 5 | 6 | jobs: 7 | build: 8 | 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - uses: actions/checkout@v2 13 | - name: Set up JDK 1.8 14 | uses: actions/setup-java@v1 15 | with: 16 | java-version: 1.8 17 | - name: Cache Maven packages 18 | uses: actions/cache@v2 19 | with: 20 | path: ~/.m2 21 | key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} 22 | restore-keys: ${{ runner.os }}-m2 23 | - name: Build with Maven 24 | run: mvn -B package --file pom.xml 25 | - run: mkdir staging && cp target/*.jar staging 26 | - uses: actions/upload-artifact@v2 27 | with: 28 | path: staging 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /.settings/ 3 | /.classpath -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | MiraiSongPlugin 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /.settings/net.sf.jautodoc.prefs: -------------------------------------------------------------------------------- 1 | add_header=true 2 | eclipse.preferences.version=1 3 | header_text=/**\r\n * Mirai Song Plugin\r\n * Copyright (C) 2021 khjxiaogu\r\n * \r\n * This program is free software\: you can redistribute it and/or modify\r\n * it under the terms of the GNU Affero General Public License as published by\r\n * the Free Software Foundation, either version 3 of the License, or\r\n * (at your option) any later version.\r\n * \r\n * This program is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r\n * GNU Affero General Public License for more details.\r\n * \r\n * You should have received a copy of the GNU Affero General Public License\r\n * along with this program. If not, see .\r\n */ 4 | project_specific_settings=true 5 | replace_header=true 6 | replacements=\n\n\nGets the\nSets the\nAdds the\nEdits the\nRemoves the\nInits the\nParses the\nCreates the\nBuilds the\nChecks if is\nPrints the\nChecks for\n\n\n 7 | visibility_private=false 8 | visibility_protected=false 9 | -------------------------------------------------------------------------------- /.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /docs/com/khjxiaogu/MiraiSongPlugin/cardprovider/class-use/AmrVoiceProvider.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 类 com.khjxiaogu.MiraiSongPlugin.cardprovider.AmrVoiceProvider的使用 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

类的使用
com.khjxiaogu.MiraiSongPlugin.cardprovider.AmrVoiceProvider

82 |
83 |
没有com.khjxiaogu.MiraiSongPlugin.cardprovider.AmrVoiceProvider的用法
84 |
85 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/com/khjxiaogu/MiraiSongPlugin/cardprovider/class-use/LightAppCardProvider.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 类 com.khjxiaogu.MiraiSongPlugin.cardprovider.LightAppCardProvider的使用 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

类的使用
com.khjxiaogu.MiraiSongPlugin.cardprovider.LightAppCardProvider

82 |
83 |
没有com.khjxiaogu.MiraiSongPlugin.cardprovider.LightAppCardProvider的用法
84 |
85 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/com/khjxiaogu/MiraiSongPlugin/cardprovider/class-use/LightAppXCardProvider.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 类 com.khjxiaogu.MiraiSongPlugin.cardprovider.LightAppXCardProvider的使用 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

类的使用
com.khjxiaogu.MiraiSongPlugin.cardprovider.LightAppXCardProvider

82 |
83 |
没有com.khjxiaogu.MiraiSongPlugin.cardprovider.LightAppXCardProvider的用法
84 |
85 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/com/khjxiaogu/MiraiSongPlugin/cardprovider/class-use/PlainMusicInfoProvider.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 类 com.khjxiaogu.MiraiSongPlugin.cardprovider.PlainMusicInfoProvider的使用 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

类的使用
com.khjxiaogu.MiraiSongPlugin.cardprovider.PlainMusicInfoProvider

82 |
83 |
没有com.khjxiaogu.MiraiSongPlugin.cardprovider.PlainMusicInfoProvider的用法
84 |
85 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/com/khjxiaogu/MiraiSongPlugin/cardprovider/class-use/ShareCardProvider.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 类 com.khjxiaogu.MiraiSongPlugin.cardprovider.ShareCardProvider的使用 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

类的使用
com.khjxiaogu.MiraiSongPlugin.cardprovider.ShareCardProvider

82 |
83 |
没有com.khjxiaogu.MiraiSongPlugin.cardprovider.ShareCardProvider的用法
84 |
85 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/com/khjxiaogu/MiraiSongPlugin/cardprovider/class-use/SilkVoiceProvider.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 类 com.khjxiaogu.MiraiSongPlugin.cardprovider.SilkVoiceProvider的使用 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

类的使用
com.khjxiaogu.MiraiSongPlugin.cardprovider.SilkVoiceProvider

82 |
83 |
没有com.khjxiaogu.MiraiSongPlugin.cardprovider.SilkVoiceProvider的用法
84 |
85 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/com/khjxiaogu/MiraiSongPlugin/cardprovider/class-use/XMLCardProvider.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 类 com.khjxiaogu.MiraiSongPlugin.cardprovider.XMLCardProvider的使用 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

类的使用
com.khjxiaogu.MiraiSongPlugin.cardprovider.XMLCardProvider

82 |
83 |
没有com.khjxiaogu.MiraiSongPlugin.cardprovider.XMLCardProvider的用法
84 |
85 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/com/khjxiaogu/MiraiSongPlugin/cardprovider/package-use.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 程序包 com.khjxiaogu.MiraiSongPlugin.cardprovider的使用 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

程序包的使用
com.khjxiaogu.MiraiSongPlugin.cardprovider

82 |
83 |
没有com.khjxiaogu.MiraiSongPlugin.cardprovider的用法
84 |
85 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/com/khjxiaogu/MiraiSongPlugin/class-use/MiraiSongPlugin.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 类 com.khjxiaogu.MiraiSongPlugin.MiraiSongPlugin的使用 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

类的使用
com.khjxiaogu.MiraiSongPlugin.MiraiSongPlugin

82 |
83 |
没有com.khjxiaogu.MiraiSongPlugin.MiraiSongPlugin的用法
84 |
85 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/com/khjxiaogu/MiraiSongPlugin/class-use/NetEaseCrypto.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 类 com.khjxiaogu.MiraiSongPlugin.NetEaseCrypto的使用 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

类的使用
com.khjxiaogu.MiraiSongPlugin.NetEaseCrypto

82 |
83 |
没有com.khjxiaogu.MiraiSongPlugin.NetEaseCrypto的用法
84 |
85 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/com/khjxiaogu/MiraiSongPlugin/class-use/PluginData.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 类 com.khjxiaogu.MiraiSongPlugin.PluginData的使用 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

类的使用
com.khjxiaogu.MiraiSongPlugin.PluginData

82 |
83 |
没有com.khjxiaogu.MiraiSongPlugin.PluginData的用法
84 |
85 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/com/khjxiaogu/MiraiSongPlugin/class-use/Utils.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 类 com.khjxiaogu.MiraiSongPlugin.Utils的使用 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

类的使用
com.khjxiaogu.MiraiSongPlugin.Utils

82 |
83 |
没有com.khjxiaogu.MiraiSongPlugin.Utils的用法
84 |
85 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/com/khjxiaogu/MiraiSongPlugin/musicsource/class-use/BaiduMusicSource.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 类 com.khjxiaogu.MiraiSongPlugin.musicsource.BaiduMusicSource的使用 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

类的使用
com.khjxiaogu.MiraiSongPlugin.musicsource.BaiduMusicSource

82 |
83 |
没有com.khjxiaogu.MiraiSongPlugin.musicsource.BaiduMusicSource的用法
84 |
85 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/com/khjxiaogu/MiraiSongPlugin/musicsource/class-use/KugouMusicSource.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 类 com.khjxiaogu.MiraiSongPlugin.musicsource.KugouMusicSource的使用 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

类的使用
com.khjxiaogu.MiraiSongPlugin.musicsource.KugouMusicSource

82 |
83 |
没有com.khjxiaogu.MiraiSongPlugin.musicsource.KugouMusicSource的用法
84 |
85 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/com/khjxiaogu/MiraiSongPlugin/musicsource/class-use/NetEaseMusicSource.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 类 com.khjxiaogu.MiraiSongPlugin.musicsource.NetEaseMusicSource的使用 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

类的使用
com.khjxiaogu.MiraiSongPlugin.musicsource.NetEaseMusicSource

82 |
83 |
没有com.khjxiaogu.MiraiSongPlugin.musicsource.NetEaseMusicSource的用法
84 |
85 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/com/khjxiaogu/MiraiSongPlugin/musicsource/class-use/QQMusicHQSource.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 类 com.khjxiaogu.MiraiSongPlugin.musicsource.QQMusicHQSource的使用 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

类的使用
com.khjxiaogu.MiraiSongPlugin.musicsource.QQMusicHQSource

82 |
83 |
没有com.khjxiaogu.MiraiSongPlugin.musicsource.QQMusicHQSource的用法
84 |
85 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/com/khjxiaogu/MiraiSongPlugin/test/class-use/Main.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 类 com.khjxiaogu.MiraiSongPlugin.test.Main的使用 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

类的使用
com.khjxiaogu.MiraiSongPlugin.test.Main

82 |
83 |
没有com.khjxiaogu.MiraiSongPlugin.test.Main的用法
84 |
85 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/com/khjxiaogu/MiraiSongPlugin/test/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.khjxiaogu.MiraiSongPlugin.test 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

程序包 com.khjxiaogu.MiraiSongPlugin.test

82 |
83 |
84 |
    85 |
  • 86 |
    87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 |
    类概要 
    说明
    Main 
    100 |
    101 |
  • 102 |
103 |
104 |
105 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /docs/com/khjxiaogu/MiraiSongPlugin/test/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.khjxiaogu.MiraiSongPlugin.test 类分层结构 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

程序包com.khjxiaogu.MiraiSongPlugin.test的分层结构

82 | 程序包分层结构: 83 | 86 |
87 |
88 |
89 |

类分层结构

90 |
    91 |
  • java.lang.Object 92 |
      93 |
    • com.khjxiaogu.MiraiSongPlugin.test.Main
    • 94 |
    95 |
  • 96 |
97 |
98 |
99 |
100 | 127 | 128 | 129 | -------------------------------------------------------------------------------- /docs/com/khjxiaogu/MiraiSongPlugin/test/package-use.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 程序包 com.khjxiaogu.MiraiSongPlugin.test的使用 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

程序包的使用
com.khjxiaogu.MiraiSongPlugin.test

82 |
83 |
没有com.khjxiaogu.MiraiSongPlugin.test的用法
84 |
85 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/constant-values.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 常量字段值 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

常量字段值

82 |
83 |

目录

84 |
85 |
86 |
87 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /docs/deprecated-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 已过时的列表 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

已过时的 API

82 |

目录

83 |
84 |
85 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/element-list: -------------------------------------------------------------------------------- 1 | com.khjxiaogu.MiraiSongPlugin 2 | com.khjxiaogu.MiraiSongPlugin.cardprovider 3 | com.khjxiaogu.MiraiSongPlugin.musicsource 4 | com.khjxiaogu.MiraiSongPlugin.test 5 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 概览 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 37 |
38 | 78 |
79 |
80 |
81 |

Mirai点歌插件

82 |
83 |
84 |
85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 |
程序包 
程序包说明
com.khjxiaogu.MiraiSongPlugin 
com.khjxiaogu.MiraiSongPlugin.cardprovider 
com.khjxiaogu.MiraiSongPlugin.musicsource 
com.khjxiaogu.MiraiSongPlugin.test 
110 |
111 |
112 |
113 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /docs/jquery/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khjxiaogu/MiraiSongPlugin/79711fcc1ae79fe51aa1d209c40e879f82f67366/docs/jquery/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-bg_glass_65_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khjxiaogu/MiraiSongPlugin/79711fcc1ae79fe51aa1d209c40e879f82f67366/docs/jquery/images/ui-bg_glass_65_dadada_1x400.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khjxiaogu/MiraiSongPlugin/79711fcc1ae79fe51aa1d209c40e879f82f67366/docs/jquery/images/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khjxiaogu/MiraiSongPlugin/79711fcc1ae79fe51aa1d209c40e879f82f67366/docs/jquery/images/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khjxiaogu/MiraiSongPlugin/79711fcc1ae79fe51aa1d209c40e879f82f67366/docs/jquery/images/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khjxiaogu/MiraiSongPlugin/79711fcc1ae79fe51aa1d209c40e879f82f67366/docs/jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khjxiaogu/MiraiSongPlugin/79711fcc1ae79fe51aa1d209c40e879f82f67366/docs/jquery/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khjxiaogu/MiraiSongPlugin/79711fcc1ae79fe51aa1d209c40e879f82f67366/docs/jquery/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khjxiaogu/MiraiSongPlugin/79711fcc1ae79fe51aa1d209c40e879f82f67366/docs/jquery/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khjxiaogu/MiraiSongPlugin/79711fcc1ae79fe51aa1d209c40e879f82f67366/docs/jquery/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khjxiaogu/MiraiSongPlugin/79711fcc1ae79fe51aa1d209c40e879f82f67366/docs/jquery/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /docs/jquery/jquery-ui.structure.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI CSS Framework 1.12.1 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | * 9 | * http://api.jqueryui.com/category/theming/ 10 | */ 11 | /* Layout helpers 12 | ----------------------------------*/ 13 | .ui-helper-hidden { 14 | display: none; 15 | } 16 | .ui-helper-hidden-accessible { 17 | border: 0; 18 | clip: rect(0 0 0 0); 19 | height: 1px; 20 | margin: -1px; 21 | overflow: hidden; 22 | padding: 0; 23 | position: absolute; 24 | width: 1px; 25 | } 26 | .ui-helper-reset { 27 | margin: 0; 28 | padding: 0; 29 | border: 0; 30 | outline: 0; 31 | line-height: 1.3; 32 | text-decoration: none; 33 | font-size: 100%; 34 | list-style: none; 35 | } 36 | .ui-helper-clearfix:before, 37 | .ui-helper-clearfix:after { 38 | content: ""; 39 | display: table; 40 | border-collapse: collapse; 41 | } 42 | .ui-helper-clearfix:after { 43 | clear: both; 44 | } 45 | .ui-helper-zfix { 46 | width: 100%; 47 | height: 100%; 48 | top: 0; 49 | left: 0; 50 | position: absolute; 51 | opacity: 0; 52 | filter:Alpha(Opacity=0); /* support: IE8 */ 53 | } 54 | 55 | .ui-front { 56 | z-index: 100; 57 | } 58 | 59 | 60 | /* Interaction Cues 61 | ----------------------------------*/ 62 | .ui-state-disabled { 63 | cursor: default !important; 64 | pointer-events: none; 65 | } 66 | 67 | 68 | /* Icons 69 | ----------------------------------*/ 70 | .ui-icon { 71 | display: inline-block; 72 | vertical-align: middle; 73 | margin-top: -.25em; 74 | position: relative; 75 | text-indent: -99999px; 76 | overflow: hidden; 77 | background-repeat: no-repeat; 78 | } 79 | 80 | .ui-widget-icon-block { 81 | left: 50%; 82 | margin-left: -8px; 83 | display: block; 84 | } 85 | 86 | /* Misc visuals 87 | ----------------------------------*/ 88 | 89 | /* Overlays */ 90 | .ui-widget-overlay { 91 | position: fixed; 92 | top: 0; 93 | left: 0; 94 | width: 100%; 95 | height: 100%; 96 | } 97 | .ui-autocomplete { 98 | position: absolute; 99 | top: 0; 100 | left: 0; 101 | cursor: default; 102 | } 103 | .ui-menu { 104 | list-style: none; 105 | padding: 0; 106 | margin: 0; 107 | display: block; 108 | outline: 0; 109 | } 110 | .ui-menu .ui-menu { 111 | position: absolute; 112 | } 113 | .ui-menu .ui-menu-item { 114 | margin: 0; 115 | cursor: pointer; 116 | /* support: IE10, see #8844 */ 117 | list-style-image: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"); 118 | } 119 | .ui-menu .ui-menu-item-wrapper { 120 | position: relative; 121 | padding: 3px 1em 3px .4em; 122 | } 123 | .ui-menu .ui-menu-divider { 124 | margin: 5px 0; 125 | height: 0; 126 | font-size: 0; 127 | line-height: 0; 128 | border-width: 1px 0 0 0; 129 | } 130 | .ui-menu .ui-state-focus, 131 | .ui-menu .ui-state-active { 132 | margin: -1px; 133 | } 134 | 135 | /* icon support */ 136 | .ui-menu-icons { 137 | position: relative; 138 | } 139 | .ui-menu-icons .ui-menu-item-wrapper { 140 | padding-left: 2em; 141 | } 142 | 143 | /* left-aligned */ 144 | .ui-menu .ui-icon { 145 | position: absolute; 146 | top: 0; 147 | bottom: 0; 148 | left: .2em; 149 | margin: auto 0; 150 | } 151 | 152 | /* right-aligned */ 153 | .ui-menu .ui-menu-icon { 154 | left: auto; 155 | right: 0; 156 | } 157 | -------------------------------------------------------------------------------- /docs/jquery/jquery-ui.structure.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.12.1 - 2018-12-06 2 | * http://jqueryui.com 3 | * Copyright jQuery Foundation and other contributors; Licensed MIT */ 4 | 5 | .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important;pointer-events:none}.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-icon-block{left:50%;margin-left:-8px;display:block}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:0}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{margin:0;cursor:pointer;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-item-wrapper{position:relative;padding:3px 1em 3px .4em}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item-wrapper{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0} -------------------------------------------------------------------------------- /docs/jquery/jszip-utils/dist/jszip-utils-ie.js: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | JSZipUtils - A collection of cross-browser utilities to go along with JSZip. 4 | 5 | 6 | (c) 2014 Stuart Knightley, David Duponchel 7 | Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. 8 | 9 | */ 10 | ;(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o\r\n"+ 18 | "\r\n"; 32 | 33 | // inject VBScript 34 | document.write(IEBinaryToArray_ByteStr_Script); 35 | 36 | global.JSZipUtils._getBinaryFromXHR = function (xhr) { 37 | var binary = xhr.responseBody; 38 | var byteMapping = {}; 39 | for ( var i = 0; i < 256; i++ ) { 40 | for ( var j = 0; j < 256; j++ ) { 41 | byteMapping[ String.fromCharCode( i + (j << 8) ) ] = 42 | String.fromCharCode(i) + String.fromCharCode(j); 43 | } 44 | } 45 | var rawBytes = IEBinaryToArray_ByteStr(binary); 46 | var lastChr = IEBinaryToArray_ByteStr_Last(binary); 47 | return rawBytes.replace(/[\s\S]/g, function( match ) { 48 | return byteMapping[match]; 49 | }) + lastChr; 50 | }; 51 | 52 | // enforcing Stuk's coding style 53 | // vim: set shiftwidth=4 softtabstop=4: 54 | 55 | },{}]},{},[1]) 56 | ; 57 | -------------------------------------------------------------------------------- /docs/jquery/jszip-utils/dist/jszip-utils-ie.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | JSZipUtils - A collection of cross-browser utilities to go along with JSZip. 4 | 5 | 6 | (c) 2014 Stuart Knightley, David Duponchel 7 | Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. 8 | 9 | */ 10 | !function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g\r\n";document.write(b),a.JSZipUtils._getBinaryFromXHR=function(a){for(var b=a.responseBody,c={},d=0;256>d;d++)for(var e=0;256>e;e++)c[String.fromCharCode(d+(e<<8))]=String.fromCharCode(d)+String.fromCharCode(e);var f=IEBinaryToArray_ByteStr(b),g=IEBinaryToArray_ByteStr_Last(b);return f.replace(/[\s\S]/g,function(a){return c[a]})+g}},{}]},{},[1]); 11 | -------------------------------------------------------------------------------- /docs/jquery/jszip-utils/dist/jszip-utils.js: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | JSZipUtils - A collection of cross-browser utilities to go along with JSZip. 4 | 5 | 6 | (c) 2014 Stuart Knightley, David Duponchel 7 | Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. 8 | 9 | */ 10 | !function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.JSZipUtils=e():"undefined"!=typeof global?global.JSZipUtils=e():"undefined"!=typeof self&&(self.JSZipUtils=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 5 | 6 | (c) 2014 Stuart Knightley, David Duponchel 7 | Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. 8 | 9 | */ 10 | !function(a){"object"==typeof exports?module.exports=a():"function"==typeof define&&define.amd?define(a):"undefined"!=typeof window?window.JSZipUtils=a():"undefined"!=typeof global?global.JSZipUtils=a():"undefined"!=typeof self&&(self.JSZipUtils=a())}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g 2 | 3 | 4 | 5 | 6 | 生成的文档 (无标题) 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | 17 |
18 | 21 |

index.html

22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /docs/package-search-index.js: -------------------------------------------------------------------------------- 1 | packageSearchIndex = [{"l":"com.khjxiaogu.MiraiSongPlugin.cardprovider"},{"l":"com.khjxiaogu.MiraiSongPlugin.musicsource"},{"l":"com.khjxiaogu.MiraiSongPlugin.test"},{"l":"所有程序包","url":"allpackages-index.html"}] -------------------------------------------------------------------------------- /docs/package-search-index.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khjxiaogu/MiraiSongPlugin/79711fcc1ae79fe51aa1d209c40e879f82f67366/docs/package-search-index.zip -------------------------------------------------------------------------------- /docs/resources/glass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khjxiaogu/MiraiSongPlugin/79711fcc1ae79fe51aa1d209c40e879f82f67366/docs/resources/glass.png -------------------------------------------------------------------------------- /docs/resources/x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khjxiaogu/MiraiSongPlugin/79711fcc1ae79fe51aa1d209c40e879f82f67366/docs/resources/x.png -------------------------------------------------------------------------------- /docs/type-search-index.js: -------------------------------------------------------------------------------- 1 | typeSearchIndex = [{"p":"com.khjxiaogu.MiraiSongPlugin.cardprovider","l":"AmrVoiceProvider"},{"p":"com.khjxiaogu.MiraiSongPlugin.musicsource","l":"BaiduMusicSource"},{"p":"com.khjxiaogu.MiraiSongPlugin.musicsource","l":"KugouMusicSource"},{"p":"com.khjxiaogu.MiraiSongPlugin.cardprovider","l":"LightAppCardProvider"},{"p":"com.khjxiaogu.MiraiSongPlugin.cardprovider","l":"LightAppXCardProvider"},{"p":"com.khjxiaogu.MiraiSongPlugin.test","l":"Main"},{"p":"com.khjxiaogu.MiraiSongPlugin","l":"MiraiSongPlugin"},{"p":"com.khjxiaogu.MiraiSongPlugin","l":"MusicCardProvider"},{"p":"com.khjxiaogu.MiraiSongPlugin","l":"MusicInfo"},{"p":"com.khjxiaogu.MiraiSongPlugin","l":"MusicSource"},{"p":"com.khjxiaogu.MiraiSongPlugin","l":"NetEaseCrypto"},{"p":"com.khjxiaogu.MiraiSongPlugin.musicsource","l":"NetEaseMusicSource"},{"p":"com.khjxiaogu.MiraiSongPlugin.cardprovider","l":"PlainMusicInfoProvider"},{"p":"com.khjxiaogu.MiraiSongPlugin","l":"PluginData"},{"p":"com.khjxiaogu.MiraiSongPlugin.musicsource","l":"QQMusicHQSource"},{"p":"com.khjxiaogu.MiraiSongPlugin.musicsource","l":"QQMusicSource"},{"p":"com.khjxiaogu.MiraiSongPlugin.cardprovider","l":"ShareCardProvider"},{"p":"com.khjxiaogu.MiraiSongPlugin.cardprovider","l":"SilkVoiceProvider"},{"p":"com.khjxiaogu.MiraiSongPlugin","l":"Utils"},{"p":"com.khjxiaogu.MiraiSongPlugin.cardprovider","l":"XMLCardProvider"},{"l":"所有类","url":"allclasses-index.html"}] -------------------------------------------------------------------------------- /docs/type-search-index.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khjxiaogu/MiraiSongPlugin/79711fcc1ae79fe51aa1d209c40e879f82f67366/docs/type-search-index.zip -------------------------------------------------------------------------------- /ffmpeg/.gitignore: -------------------------------------------------------------------------------- 1 | /ffmpeg.exe 2 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | com.khjxiaogu 6 | MiraiSongPlugin 7 | 1.2.2 8 | MiraiSongPlugin 9 | 使用“#音乐 关键词”、“#QQ 关键词”、“#网易 关键词”等方式进行点歌的插件。 10 | 11 | ${project.name}-2.7-${project.version} 12 | src/main/java 13 | 14 | 15 | src/main/resources 16 | true 17 | 18 | 19 | 20 | 21 | org.codehaus.mojo 22 | templating-maven-plugin 23 | 1.0.0 24 | 25 | 26 | filter-src 27 | 28 | filter-sources 29 | 30 | 31 | 32 | @ 33 | 34 | 35 | 36 | 37 | 38 | 39 | org.apache.maven.plugins 40 | maven-shade-plugin 41 | 3.2.1 42 | 43 | 44 | false 45 | true 46 | 47 | 48 | com.google.code.gson:gson 49 | 50 | 51 | 52 | 53 | com.google.gson 54 | ${project.groupId}.${project.artifactId}.gson 55 | 56 | 57 | 58 | 59 | 60 | package 61 | 62 | shade 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | UTF-8 71 | 点歌插件 72 | khjxiaogu 73 | 1.8 74 | 1.8 75 | 76 | 77 | 78 | alimaven 79 | aliyun maven 80 | http://maven.aliyun.com/nexus/content/groups/public/ 81 | 82 | 83 | globalmvn 84 | https://mvnrepository.com/artifact/ 85 | 86 | 87 | 88 | 89 | net.mamoe 90 | mirai-console 91 | 2.12.2 92 | provided 93 | 94 | 95 | net.mamoe 96 | mirai-core-all 97 | 2.12.2 98 | provided 99 | 100 | 101 | com.google.code.gson 102 | gson 103 | 2.8.6 104 | 105 | 106 | -------------------------------------------------------------------------------- /silk_v3_encoder.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khjxiaogu/MiraiSongPlugin/79711fcc1ae79fe51aa1d209c40e879f82f67366/silk_v3_encoder.exe -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | /test/ 2 | -------------------------------------------------------------------------------- /src/main/java-templates/com/khjxiaogu/MiraiSongPlugin/PluginData.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin; 19 | 20 | // TODO: Auto-generated Javadoc 21 | /** 22 | * 自动替换的插件信息工具类 23 | * 24 | * @author khjxiaogu 25 | * file: PluginData.java 26 | * time: 2020年9月12日 27 | */ 28 | public class PluginData { 29 | /** 30 | * The Id.
31 | * 插件id. 32 | */ 33 | public static String id = "@project.groupId@.mirai.@project.artifactId@"; 34 | 35 | /** 36 | * The name.
37 | * 插件名称. 38 | */ 39 | public static String name = "@mirai.plugin.name@"; 40 | 41 | /** 42 | * The ver.
43 | * 插件版本. 44 | */ 45 | public static String ver = "@project.version@"; 46 | 47 | /** 48 | * The auth.
49 | * 插件作者. 50 | */ 51 | public static String auth = "@mirai.plugin.author@"; 52 | 53 | /** 54 | * The info.
55 | * 插件信息. 56 | */ 57 | public static String info = "@project.description@"; 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/JsonBuilder.java: -------------------------------------------------------------------------------- 1 | package com.khjxiaogu.MiraiSongPlugin; 2 | 3 | import com.google.gson.JsonArray; 4 | import com.google.gson.JsonElement; 5 | import com.google.gson.JsonObject; 6 | 7 | public class JsonBuilder { 8 | 9 | public JsonBuilder() { 10 | } 11 | public static JsonArrayBuilder array(){ 12 | return new JsonArrayBuilder<>(null); 13 | } 14 | public static JsonObjectBuilder object(){ 15 | return new JsonObjectBuilder<>(null); 16 | } 17 | public static class JsonArrayBuilder { 18 | JsonArray jo=new JsonArray(); 19 | T parent; 20 | private JsonArrayBuilder(T par) { 21 | parent=par; 22 | } 23 | public T end() { 24 | if(parent==null) 25 | return (T) jo; 26 | return parent; 27 | } 28 | public JsonArrayBuilder add(String v){ 29 | jo.add(v); 30 | return this; 31 | } 32 | public JsonArrayBuilder add(Number v){ 33 | jo.add(v); 34 | return this; 35 | } 36 | public JsonArrayBuilder add(boolean v){ 37 | jo.add(v); 38 | return this; 39 | } 40 | public JsonArrayBuilder add(Character v){ 41 | jo.add(v); 42 | return this; 43 | } 44 | public JsonArrayBuilder add(JsonElement v){ 45 | jo.add(v); 46 | return this; 47 | } 48 | public JsonObjectBuilder> object(){ 49 | JsonObjectBuilder> job= new JsonObjectBuilder<>(this); 50 | this.add(job.get()); 51 | return job; 52 | } 53 | public JsonArrayBuilder> array(){ 54 | JsonArrayBuilder> job= new JsonArrayBuilder<>(this); 55 | this.add(job.get()); 56 | return job; 57 | } 58 | public JsonArray get() { 59 | return jo; 60 | }; 61 | public String toString() { 62 | return jo.toString(); 63 | } 64 | } 65 | public static class JsonObjectBuilder { 66 | JsonObject jo=new JsonObject(); 67 | T parent; 68 | private JsonObjectBuilder(T par) { 69 | parent=par; 70 | } 71 | 72 | public T end() { 73 | if(parent==null) 74 | return (T) jo; 75 | return parent; 76 | } 77 | public JsonObjectBuilder add(String k,String v){ 78 | jo.addProperty(k,v); 79 | return this; 80 | } 81 | public JsonObjectBuilder add(String k,Number v){ 82 | jo.addProperty(k,v); 83 | return this; 84 | } 85 | public JsonObjectBuilder add(String k,boolean v){ 86 | jo.addProperty(k,v); 87 | return this; 88 | } 89 | public JsonObjectBuilder add(String k,Character v){ 90 | jo.addProperty(k, v); 91 | return this; 92 | } 93 | public JsonObjectBuilder add(String k,JsonElement v){ 94 | jo.add(k, v); 95 | return this; 96 | } 97 | public JsonObjectBuilder> object(String k){ 98 | JsonObjectBuilder> job= new JsonObjectBuilder>(this); 99 | this.add(k, job.get()); 100 | return job; 101 | } 102 | public JsonArrayBuilder> array(String k){ 103 | JsonArrayBuilder> job= new JsonArrayBuilder<>(this); 104 | this.add(k,job.get()); 105 | return job; 106 | } 107 | public JsonObject get() { 108 | return jo; 109 | }; 110 | public String toString() { 111 | return jo.toString(); 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/MusicCardProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin; 19 | 20 | import net.mamoe.mirai.contact.Contact; 21 | import net.mamoe.mirai.message.data.Message; 22 | 23 | /** 24 | * 生成音乐卡片的接口 25 | * 26 | * @author khjxiaogu 27 | * file: MusicCardProvider.java 28 | * time: 2020年8月26日 29 | */ 30 | @FunctionalInterface 31 | public interface MusicCardProvider { 32 | 33 | /** 34 | * 处理音乐信息并生成卡片.
35 | * 36 | * @param mi 音乐信息 37 | * @param ct 请求该信息的联系人,可能为群或者好友,用于上传图片等用,不要直接给他们发信息,应该通过返回值 38 | * @return 返回要回传的音乐卡片信息 39 | * @throws Exception 发生任意异常 40 | */ 41 | public Message process(MusicInfo mi, Contact ct) throws Exception; 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/MusicInfo.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin; 19 | 20 | import java.util.Map; 21 | 22 | // TODO: Auto-generated Javadoc 23 | /** 24 | * Class MusicInfo. 25 | * 26 | * @author khjxiaogu 27 | * file: MusicInfo.java 28 | * @date 2022年8月22日 29 | */ 30 | public class MusicInfo { 31 | 32 | /** The title.
音乐名称 */ 33 | public final String title; 34 | 35 | /** The desc.
音乐描述 */ 36 | public final String desc; 37 | 38 | /** The purl.
图片地址,必须能够外界直接访问 */ 39 | public final String purl; 40 | 41 | /** The murl.
音频地址,必须能够外界直接访问 */ 42 | public final String murl; 43 | 44 | /** The jurl.
跳转地址,必须能够外界直接访问 */ 45 | public final String jurl; 46 | 47 | /** The source.
音乐源名称 */ 48 | public final String source; 49 | 50 | /** The icon.
音乐源图标地址 */ 51 | public final String icon; 52 | 53 | /** The appid.
音乐软件appid,用于发送卡片 */ 54 | public final long appid; 55 | 56 | /** The properties.
请求上述链接的而外http HEAD,可能为null */ 57 | public Map properties; 58 | 59 | /** 60 | * Instantiates a new MusicInfo.
61 | * 62 | * @param title the title
63 | * @param desc the desc
64 | * @param purl the purl
65 | * @param murl the murl
66 | * @param jurl the jurl
67 | * @param source the source
68 | * @param icon the icon
69 | * @param appid the appid
70 | */ 71 | public MusicInfo(String title, String desc, String purl, String murl, String jurl, String source, String icon, 72 | long appid) { 73 | this.title = title; 74 | this.desc = desc; 75 | this.purl = purl; 76 | this.murl = murl; 77 | this.jurl = jurl; 78 | this.source = source; 79 | this.icon = icon; 80 | this.appid = appid; 81 | } 82 | 83 | /** 84 | * Instantiates a new MusicInfo.
85 | * 86 | * @param title the title
87 | * @param desc the desc
88 | * @param purl the purl
89 | * @param murl the murl
90 | * @param jurl the jurl
91 | * @param source the source
92 | */ 93 | public MusicInfo(String title, String desc, String purl, String murl, String jurl, String source) { 94 | this.appid = 0; 95 | this.icon = ""; 96 | this.source = source; 97 | this.title = title; 98 | this.desc = desc; 99 | this.purl = purl; 100 | this.murl = murl; 101 | this.jurl = jurl; 102 | } 103 | 104 | /** 105 | * Instantiates a new MusicInfo.
106 | * 107 | * @param title the title
108 | * @param desc the desc
109 | * @param purl the purl
110 | * @param murl the murl
111 | * @param jurl the jurl
112 | * @param source the source
113 | * @param icon the icon
114 | */ 115 | public MusicInfo(String title, String desc, String purl, String murl, String jurl, String source, String icon) { 116 | this.title = title; 117 | this.desc = desc; 118 | this.purl = purl; 119 | this.murl = murl; 120 | this.jurl = jurl; 121 | this.source = source; 122 | this.icon = icon; 123 | this.appid = 0; 124 | } 125 | 126 | @Override 127 | public String toString() { 128 | return "歌曲信息\n歌名:" + title + "\n作者:" + desc + "\n封面:" + purl + "\n音频:" + murl + "\n链接:" + jurl 129 | + "\n来自:" + source + "\n小图标:" + icon + "\nAPPID:" + appid; 130 | } 131 | } -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/MusicSource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin; 19 | 20 | // TODO: Auto-generated Javadoc 21 | 22 | /** 23 | * 音乐来源接口. 24 | * 25 | * @author khjxiaogu 26 | * file: MusicSource.java 27 | * time: 2020年8月26日 28 | */ 29 | public interface MusicSource { 30 | 31 | /** 32 | * 搜索对应关键词并返回音乐信息.
33 | * 返回音乐信息不能为null。 34 | * 35 | * @param keyword 关键词 36 | * @return return 返回音乐信息数据类 37 | * @throws Exception 如果发生异常或者找不到音乐,都抛出异常。 38 | */ 39 | public MusicInfo get(String keyword) throws Exception; 40 | /** 41 | * 搜索对应音乐ID并返回音乐信息.
42 | * 返回音乐信息不能为null。 43 | * 44 | * @param keyword 音乐 45 | * @return return 返回音乐信息数据类 46 | * @throws Exception 如果发生异常或者找不到音乐,都抛出异常。 47 | */ 48 | public MusicInfo getId(String id) throws Exception; 49 | 50 | /** 51 | * 返回是否对全部搜索可见
52 | * 53 | * @return 如果是全部搜索可以搜索本来源,返回true. 54 | */ 55 | public default boolean isVisible() { 56 | return true; 57 | }; 58 | } -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/SongIdMatcher.java: -------------------------------------------------------------------------------- 1 | package com.khjxiaogu.MiraiSongPlugin; 2 | 3 | import java.util.Objects; 4 | import java.util.regex.Matcher; 5 | import java.util.regex.Pattern; 6 | 7 | import net.mamoe.mirai.contact.Contact; 8 | import net.mamoe.mirai.message.data.Message; 9 | 10 | public class SongIdMatcher { 11 | Pattern mc; 12 | MusicSource src; 13 | MusicCardProvider card; 14 | public SongIdMatcher(String regex,MusicSource src,MusicCardProvider cd) { 15 | mc=Pattern.compile(regex); 16 | this.src=Objects.requireNonNull(src); 17 | this.card=Objects.requireNonNull(cd); 18 | } 19 | public Message test(String s,Contact ct) throws Exception { 20 | Matcher m=mc.matcher(s); 21 | if(m.find()) { 22 | return card.process(src.getId(m.group(1)),ct); 23 | } 24 | return null; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/cardprovider/AmrVoiceProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.cardprovider; 19 | 20 | import java.io.File; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.io.OutputStream; 25 | import java.net.URL; 26 | import java.net.URLConnection; 27 | import java.util.Map; 28 | 29 | import com.khjxiaogu.MiraiSongPlugin.MusicCardProvider; 30 | import com.khjxiaogu.MiraiSongPlugin.MusicInfo; 31 | import com.khjxiaogu.MiraiSongPlugin.Utils; 32 | 33 | import net.mamoe.mirai.contact.Contact; 34 | import net.mamoe.mirai.message.data.Message; 35 | import net.mamoe.mirai.message.data.PlainText; 36 | import net.mamoe.mirai.utils.ExternalResource; 37 | import net.mamoe.mirai.utils.OverFileSizeMaxException; 38 | 39 | public class AmrVoiceProvider implements MusicCardProvider { 40 | public static String ffmpeg = "ffmpeg"; 41 | public static boolean autoSize = false; 42 | public static boolean wideBrand = false; 43 | private final static String[] brs = new String[] { "23.05k", "19.85k", "18.25k", "15.85k", "14.25k", "12.65k", 44 | "8.85k", "6.6k" }; 45 | public static String customCommand; 46 | 47 | public AmrVoiceProvider() { 48 | } 49 | 50 | @Override 51 | public Message process(MusicInfo mi, Contact ct) { 52 | URLConnection huc2 = null; 53 | try { 54 | huc2 = new URL(mi.murl).openConnection(); 55 | if (mi.properties != null) 56 | for (Map.Entry me : mi.properties.entrySet()) 57 | huc2.addRequestProperty(me.getKey(), me.getValue()); 58 | huc2.connect(); 59 | } catch (IOException e) { 60 | return new PlainText("获取音频失败"); 61 | } 62 | File f = new File("temp/", "wv" + System.currentTimeMillis() + ".m4a"); 63 | // File f2 = new File("./temp/", "wv" + System.currentTimeMillis() + ".silk"); 64 | // File ft = new File("./temp/", "wv" + System.currentTimeMillis() + ".pcm"); 65 | File f2 = new File("temp/", "wv" + System.currentTimeMillis() + ".amr"); 66 | try { 67 | f.getParentFile().mkdirs(); 68 | OutputStream os = new FileOutputStream(f); 69 | os.write(Utils.readAll(huc2.getInputStream())); 70 | os.flush(); 71 | os.close(); 72 | while(!new File(f.getAbsolutePath()).exists()); 73 | if (customCommand != null) { 74 | Utils.exeCmd(customCommand.replace("%input%", f.getAbsolutePath()).replace("%output%", 75 | f2.getAbsolutePath())); 76 | try (FileInputStream fis = new FileInputStream(f2);ExternalResource ex=ExternalResource.create(fis)) { 77 | return Utils.uploadVoice(ex,ct); 78 | } 79 | } else if (wideBrand) { 80 | if (autoSize) 81 | Utils.exeCmd(ffmpeg, "-i", f.getAbsolutePath(), "-ab", "23.85k", "-ar", "16000", 82 | "-ac", "1", "-acodec", "amr_wb", "-fs", "1000000", "-y", f2.getAbsolutePath()); 83 | else 84 | Utils.exeCmd(ffmpeg, "-i", f.getAbsolutePath(), "-ab", "23.85k", "-ar", "16000", 85 | "-ac", "1", "-acodec", "amr_wb", "-y", f2.getAbsolutePath()); 86 | int i = 0; 87 | do { 88 | try { 89 | try (FileInputStream fis = new FileInputStream(f2);ExternalResource ex=ExternalResource.create(fis)) { 90 | return Utils.uploadVoice(ex,ct); 91 | } 92 | } catch (OverFileSizeMaxException ofse) { 93 | Utils.exeCmd(ffmpeg, "-i", f.getAbsolutePath(), "-ab", brs[i], "-ar", "16000", 94 | "-ac", "1", "-acodec", "amr_wb", "-y", f2.getAbsolutePath()); 95 | i++; 96 | } 97 | } while (autoSize); 98 | } else { 99 | Utils.exeCmd(ffmpeg, "-i", f.getAbsolutePath(), "-ab", "12.2k", "-ar", "8000", "-ac", 100 | "1", "-fs", "1000000", "-y", f2.getAbsolutePath()); 101 | 102 | try (FileInputStream fis = new FileInputStream(f2);ExternalResource ex=ExternalResource.create(fis)) { 103 | return Utils.uploadVoice(ex,ct); 104 | } 105 | } 106 | 107 | } catch (Exception e1) { 108 | // TODO Auto-generated catch block 109 | e1.printStackTrace(); 110 | } finally { 111 | f.delete(); 112 | // ft.delete(); 113 | f2.delete(); 114 | } 115 | return new PlainText("当前状态不支持音频"); 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/cardprovider/LightAppCardProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.cardprovider; 19 | 20 | import com.google.gson.JsonObject; 21 | import com.khjxiaogu.MiraiSongPlugin.MusicCardProvider; 22 | import com.khjxiaogu.MiraiSongPlugin.MusicInfo; 23 | 24 | import net.mamoe.mirai.contact.Contact; 25 | import net.mamoe.mirai.message.data.LightApp; 26 | import net.mamoe.mirai.message.data.MessageChain; 27 | 28 | public class LightAppCardProvider implements MusicCardProvider { 29 | 30 | public LightAppCardProvider() { 31 | } 32 | 33 | @Override 34 | public MessageChain process(MusicInfo mi, Contact ct) { 35 | JsonObject appmsg = new JsonObject(); 36 | appmsg.addProperty("app", "com.tencent.structmsg"); 37 | appmsg.addProperty("view", "music"); 38 | appmsg.addProperty("ver", "0.0.0.1"); 39 | appmsg.addProperty("desc", "音乐"); 40 | appmsg.addProperty("prompt", mi.title); 41 | // "autosize":true, 42 | // "ctime":1601797108, 43 | // "forward":true, 44 | // "type":"normal" 45 | JsonObject config = new JsonObject(); 46 | config.addProperty("autosize", true); 47 | config.addProperty("forward", true); 48 | config.addProperty("token", ""); 49 | config.addProperty("type", "normal"); 50 | JsonObject extra = new JsonObject(); 51 | extra.addProperty("app_type", 1); 52 | extra.addProperty("appid", mi.appid); 53 | extra.addProperty("uin", ct.getId()); 54 | appmsg.add("extra", extra); 55 | JsonObject meta = new JsonObject(); 56 | appmsg.add("meta", meta); 57 | JsonObject music = new JsonObject(); 58 | meta.add("music", music); 59 | music.addProperty("action", ""); 60 | music.addProperty("android_pkg_name", ""); 61 | music.addProperty("app_type", 1); 62 | music.addProperty("appid", mi.appid); 63 | music.addProperty("preview", mi.purl); 64 | music.addProperty("desc", mi.desc); 65 | music.addProperty("jumpUrl", mi.jurl); 66 | music.addProperty("musicUrl", mi.murl); 67 | music.addProperty("sourceMsgId", "0"); 68 | music.addProperty("source_icon", mi.icon); 69 | music.addProperty("source_url", ""); 70 | music.addProperty("tag", mi.source); 71 | music.addProperty("title", mi.title); 72 | return new LightApp(appmsg.toString()).plus("[分享]").plus(mi.title).plus("\n").plus(mi.desc).plus("\n") 73 | .plus(mi.jurl).plus("\n[来自]").plus(mi.source); 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/cardprovider/LightAppXCardProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.cardprovider; 19 | 20 | import com.google.gson.JsonObject; 21 | import com.khjxiaogu.MiraiSongPlugin.MusicCardProvider; 22 | import com.khjxiaogu.MiraiSongPlugin.MusicInfo; 23 | import com.khjxiaogu.MiraiSongPlugin.Utils; 24 | 25 | import net.mamoe.mirai.contact.Contact; 26 | import net.mamoe.mirai.message.data.LightApp; 27 | import net.mamoe.mirai.message.data.Message; 28 | 29 | public class LightAppXCardProvider implements MusicCardProvider { 30 | 31 | public LightAppXCardProvider() { 32 | } 33 | 34 | @Override 35 | public Message process(MusicInfo mi, Contact ct) throws Exception { 36 | JsonObject appmsg = new JsonObject(); 37 | appmsg.addProperty("app", "com.tencent.miniapp_01"); 38 | JsonObject cfg = new JsonObject(); 39 | cfg.addProperty("autosize", 0); 40 | cfg.addProperty("ctime", Utils.getTime() / 1000); 41 | cfg.addProperty("token", "a95f83e736db2f94d88f9974c09717ad"); 42 | cfg.addProperty("type", "normal"); 43 | cfg.addProperty("forward", 1); 44 | appmsg.add("config", cfg); 45 | appmsg.addProperty("view", "music"); 46 | appmsg.addProperty("ver", "1.0.0.19"); 47 | appmsg.addProperty("desc", "音乐"); 48 | appmsg.addProperty("view", "view_8C8E89B49BE609866298ADDFF2DBABA4"); 49 | appmsg.addProperty("prompt", mi.title); 50 | JsonObject meta = new JsonObject(); 51 | appmsg.add("meta", meta); 52 | JsonObject music = new JsonObject(); 53 | meta.add("music", music); 54 | music.addProperty("action", ""); 55 | music.addProperty("android_pkg_name", ""); 56 | music.addProperty("app_type", 1); 57 | music.addProperty("appid", mi.appid); 58 | music.addProperty("preview", mi.purl); 59 | music.addProperty("desc", mi.desc); 60 | music.addProperty("jumpUrl", mi.jurl); 61 | music.addProperty("musicUrl", mi.murl); 62 | music.addProperty("sourceMsgId", "0"); 63 | music.addProperty("source_icon", mi.icon); 64 | music.addProperty("source_url", ""); 65 | music.addProperty("tag", mi.source); 66 | music.addProperty("title", mi.title); 67 | JsonObject detail = new JsonObject(); 68 | meta.add("detail_1", detail); 69 | detail.addProperty("appid", mi.appid); 70 | detail.addProperty("desc", mi.desc); 71 | detail.addProperty("icon", mi.icon); 72 | detail.addProperty("preview", mi.purl); 73 | detail.addProperty("qqdocurl", mi.jurl); 74 | detail.addProperty("scene", 1036); 75 | detail.addProperty("shareTemplateId", "8C8E89B49BE609866298ADDFF2DBABA4"); 76 | detail.add("shareTemplateData", new JsonObject()); 77 | detail.addProperty("title", mi.title); 78 | return new LightApp(appmsg.toString()).plus(mi.jurl); 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/cardprovider/MiraiMusicCard.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.cardprovider; 19 | 20 | import java.util.HashMap; 21 | import java.util.Map; 22 | 23 | import com.khjxiaogu.MiraiSongPlugin.MusicCardProvider; 24 | import com.khjxiaogu.MiraiSongPlugin.MusicInfo; 25 | 26 | import net.mamoe.mirai.contact.Contact; 27 | import net.mamoe.mirai.message.data.Message; 28 | import net.mamoe.mirai.message.data.MusicKind; 29 | import net.mamoe.mirai.message.data.MusicShare; 30 | 31 | public class MiraiMusicCard implements MusicCardProvider { 32 | static Map appidMappings=new HashMap<>(); 33 | static MusicCardProvider def=new XMLCardProvider(); 34 | static { 35 | for(MusicKind mk:MusicKind.values()) 36 | appidMappings.put(mk.getAppId(),mk); 37 | } 38 | @Override 39 | public Message process(MusicInfo mi, Contact ct) throws Exception { 40 | MusicKind omk=appidMappings.get(mi.appid); 41 | if(omk!=null) 42 | return new MusicShare(omk,mi.title,mi.desc,mi.jurl,mi.purl,mi.murl); 43 | return def.process(mi, ct); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/cardprovider/PlainMusicInfoProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.cardprovider; 19 | 20 | import java.io.IOException; 21 | import java.net.MalformedURLException; 22 | 23 | import com.khjxiaogu.MiraiSongPlugin.MusicCardProvider; 24 | import com.khjxiaogu.MiraiSongPlugin.MusicInfo; 25 | import com.khjxiaogu.MiraiSongPlugin.Utils; 26 | 27 | import net.mamoe.mirai.contact.Contact; 28 | import net.mamoe.mirai.message.data.Image; 29 | import net.mamoe.mirai.message.data.Message; 30 | import net.mamoe.mirai.message.data.PlainText; 31 | import net.mamoe.mirai.utils.ExternalResource; 32 | import net.mamoe.mirai.utils.OverFileSizeMaxException; 33 | 34 | public class PlainMusicInfoProvider implements MusicCardProvider { 35 | 36 | public PlainMusicInfoProvider() { 37 | } 38 | 39 | @Override 40 | public Message process(MusicInfo mi, Contact ct) throws OverFileSizeMaxException, MalformedURLException { 41 | Image im = null; 42 | try(ExternalResource ex=ExternalResource.create(Utils.getFromHttp(mi.purl))){ 43 | im = ct.uploadImage(ex); 44 | } catch (IOException e) { 45 | } 46 | StringBuilder tsb = new StringBuilder().append("歌名:").append(mi.title).append("\n作者:").append(mi.desc) 47 | .append("\n封面:").append(mi.purl).append("\n外链:").append(mi.murl).append("\n链接:").append(mi.jurl) 48 | .append("\n来自:").append(mi.source); 49 | if (im != null) 50 | return im.plus(tsb.toString()); 51 | return new PlainText(tsb.toString()); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/cardprovider/ShareCardProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.cardprovider; 19 | 20 | import com.khjxiaogu.MiraiSongPlugin.MusicCardProvider; 21 | import com.khjxiaogu.MiraiSongPlugin.MusicInfo; 22 | 23 | import net.mamoe.mirai.contact.Contact; 24 | import net.mamoe.mirai.message.data.Message; 25 | import net.mamoe.mirai.message.data.RichMessage; 26 | 27 | public class ShareCardProvider implements MusicCardProvider { 28 | 29 | public ShareCardProvider() { 30 | } 31 | 32 | @Override 33 | public Message process(MusicInfo mi, Contact ct) { 34 | return RichMessage.share(mi.jurl.replaceAll("\\&", "&"), mi.title, mi.desc, 35 | mi.purl.replaceAll("\\&", "&")); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/cardprovider/SilkVoiceProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.cardprovider; 19 | 20 | import java.io.File; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.io.OutputStream; 25 | import java.net.HttpURLConnection; 26 | import java.net.URL; 27 | import java.util.Map; 28 | 29 | import com.khjxiaogu.MiraiSongPlugin.MusicCardProvider; 30 | import com.khjxiaogu.MiraiSongPlugin.MusicInfo; 31 | import com.khjxiaogu.MiraiSongPlugin.Utils; 32 | 33 | import net.mamoe.mirai.contact.Contact; 34 | import net.mamoe.mirai.message.data.Message; 35 | import net.mamoe.mirai.message.data.PlainText; 36 | import net.mamoe.mirai.utils.ExternalResource; 37 | 38 | public class SilkVoiceProvider implements MusicCardProvider { 39 | public static String silk = "silk_v3_encoder"; 40 | public static String ffmpeg ="ffmpeg"; 41 | 42 | public SilkVoiceProvider() { 43 | } 44 | 45 | @Override 46 | public Message process(MusicInfo mi, Contact ct) { 47 | HttpURLConnection huc2 = null; 48 | try { 49 | huc2 = (HttpURLConnection) new URL(mi.murl).openConnection(); 50 | if (mi.properties != null) 51 | for (Map.Entry me : mi.properties.entrySet()) 52 | huc2.addRequestProperty(me.getKey(), me.getValue()); 53 | huc2.setRequestMethod("GET"); 54 | huc2.connect(); 55 | } catch (IOException e) { 56 | return new PlainText("获取音频失败"); 57 | } 58 | File f = new File("temp/", "wv" + System.currentTimeMillis() + ".m4a"); 59 | File f2 = new File("temp/", "wv" + System.currentTimeMillis() + ".silk"); 60 | File ft = new File("temp/", "wv" + System.currentTimeMillis() + ".pcm"); 61 | // File f2=new File("./temp/","wv"+System.currentTimeMillis()+".amr"); 62 | try { 63 | f.getParentFile().mkdirs(); 64 | OutputStream os = new FileOutputStream(f); 65 | os.write(Utils.readAll(huc2.getInputStream())); 66 | 67 | os.close(); 68 | // exeCmd(new File("ffmpeg.exe").getAbsolutePath() + " -i \"" + 69 | // f.getAbsolutePath() 70 | // + "\" -ab 12.2k -ar 8000 -ac 1 -y " + f2.getAbsolutePath()); 71 | Utils.exeCmd(ffmpeg, "-i", f.getAbsolutePath(), "-f", "s16le", "-ar", "24000", "-ac", "1", 72 | "-acodec", "pcm_s16le", "-y", ft.getAbsolutePath()); 73 | Utils.exeCmd(silk, ft.getAbsolutePath(), f2.getAbsolutePath(), "-Fs_API", "24000", 74 | "-tencent"); 75 | try (FileInputStream fis = new FileInputStream(f2);ExternalResource ex=ExternalResource.create(fis)) { 76 | return Utils.uploadVoice(ex,ct); 77 | } 78 | } catch (IOException e1) { 79 | // TODO Auto-generated catch block 80 | e1.printStackTrace(); 81 | } finally { 82 | f.delete(); 83 | ft.delete(); 84 | f2.delete(); 85 | } 86 | return new PlainText("当前状态不支持音频"); 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/cardprovider/XMLCardProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.cardprovider; 19 | 20 | import com.khjxiaogu.MiraiSongPlugin.MusicCardProvider; 21 | import com.khjxiaogu.MiraiSongPlugin.MusicInfo; 22 | 23 | import net.mamoe.mirai.contact.Contact; 24 | import net.mamoe.mirai.message.data.Message; 25 | import net.mamoe.mirai.message.data.MessageChain; 26 | import net.mamoe.mirai.message.data.SimpleServiceMessage; 27 | 28 | public class XMLCardProvider implements MusicCardProvider { 29 | 30 | public XMLCardProvider() { 31 | } 32 | 33 | @Override 34 | public MessageChain process(MusicInfo mi, Contact ct) { 35 | StringBuilder xmb = new StringBuilder("\r\n\r\n") 38 | .append("\r\n\r\n"); 45 | Message msg = new SimpleServiceMessage(2, xmb.toString()); 46 | return msg.plus(mi.jurl); 47 | } 48 | 49 | public String escapeXmlContent(String org) { 50 | return org.replaceAll("<", "<").replaceAll(">", ">"); 51 | } 52 | 53 | public String escapeXmlTag(String org) { 54 | return org.replaceAll("\\&", "&").replaceAll("\"", """).replaceAll("'", "'") 55 | .replaceAll("<", "<").replaceAll(">", ">"); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/musicsource/BaiduMusicSource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.musicsource; 19 | 20 | import java.net.HttpURLConnection; 21 | import java.net.URL; 22 | 23 | import com.google.gson.JsonObject; 24 | import com.google.gson.JsonParser; 25 | import com.khjxiaogu.MiraiSongPlugin.HttpRequestBuilder; 26 | import com.khjxiaogu.MiraiSongPlugin.MusicInfo; 27 | import com.khjxiaogu.MiraiSongPlugin.MusicSource; 28 | import com.khjxiaogu.MiraiSongPlugin.Utils; 29 | 30 | public class BaiduMusicSource implements MusicSource { 31 | 32 | public BaiduMusicSource() { 33 | } 34 | 35 | @Override 36 | public MusicInfo get(String keyword) throws Exception { 37 | JsonObject jo; 38 | int requested = 0; 39 | HttpRequestBuilder req=HttpRequestBuilder.create("http","music.baidu.com") 40 | .url("/v1/restserver/ting?format=json&calback=&from=webapp_music&method=baidu.ting.search.catalogSug&query=") 41 | .url(Utils.urlEncode(keyword)) 42 | .referer("http://music.91q.com/") 43 | .defUA(); 44 | do { 45 | 46 | jo = req.get().readJson(); 47 | } while (jo.get("error_code").getAsInt() != 22000 && requested++ < 3);// 百度有时候会请求失败,不断请求直到成功。 48 | String sid = jo.getAsJsonObject().getAsJsonObject().get("song").getAsJsonArray().get(0).getAsJsonObject() 49 | .get("songid").getAsString(); 50 | return getId(sid); 51 | } 52 | 53 | @Override 54 | public MusicInfo getId(String sid) throws Exception { 55 | HttpURLConnection huc = (HttpURLConnection) new URL( 56 | "http://tingapi.ting.baidu.com/v1/restserver/ting?format=json&calback=&from=webapp_music&method=baidu.ting.song.play&songid=" 57 | + sid).openConnection(); 58 | huc.setRequestProperty("Host", "tingapi.ting.baidu.com"); 59 | huc.setRequestProperty("Referrer", "http://music.taihe.com/"); 60 | huc.setRequestProperty("User-Agent", 61 | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36"); 62 | huc.setRequestMethod("GET"); 63 | huc.connect(); 64 | JsonObject allinfo = JsonParser.parseString(new String(Utils.readAll(huc.getInputStream()), "UTF-8")) 65 | .getAsJsonObject(); 66 | JsonObject sif = allinfo.getAsJsonObject().get("songinfo").getAsJsonObject(); 67 | huc.disconnect(); 68 | return new MusicInfo(sif.get("title").getAsString(), sif.get("author").getAsString(), 69 | sif.get("pic_big").getAsString(), 70 | allinfo.get("bitrate").getAsJsonObject().get("file_link").getAsString(), 71 | sif.get("share_url") != null ? sif.get("share_url").getAsString() : "", "千千静听"); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/musicsource/BiliBiliMusicSource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.musicsource; 19 | 20 | import java.util.HashMap; 21 | 22 | import com.google.gson.JsonArray; 23 | import com.google.gson.JsonObject; 24 | import com.khjxiaogu.MiraiSongPlugin.HttpRequestBuilder; 25 | import com.khjxiaogu.MiraiSongPlugin.MusicInfo; 26 | import com.khjxiaogu.MiraiSongPlugin.MusicSource; 27 | import com.khjxiaogu.MiraiSongPlugin.Utils; 28 | 29 | public class BiliBiliMusicSource implements MusicSource { 30 | 31 | @Override 32 | public MusicInfo get(String keyword) throws Exception { 33 | JsonArray ja=HttpRequestBuilder.create("api.bilibili.com") 34 | .url("/audio/music-service-c/s?keyword=") 35 | .url(Utils.urlEncode(keyword)) 36 | .get() 37 | .readJson().get("data").getAsJsonObject().get("result").getAsJsonArray(); 38 | String murl; 39 | JsonObject jo = ja.get(0).getAsJsonObject(); 40 | JsonArray pl = jo.get("play_url_list").getAsJsonArray(); 41 | int i = 0; 42 | while (pl.size() <= 0) { 43 | jo = ja.get(++i).getAsJsonObject(); 44 | pl = jo.get("play_url_list").getAsJsonArray(); 45 | } 46 | murl = pl.get(pl.size() > 1 ? 1 : 0).getAsJsonObject().get("url").getAsString(); 47 | MusicInfo mi = new MusicInfo(jo.get("title").getAsString(), 48 | "UP:" + jo.get("up_name").getAsString() + "创作:" + jo.get("author").getAsString(), 49 | jo.get("cover").getAsString(), murl, "https://www.bilibili.com/audio/au" + jo.get("id").getAsString(), 50 | "哔哩哔哩","https://open.gtimg.cn/open/app_icon/00/95/17/76/100951776_100_m.png?t=1624441854",100951776); 51 | mi.properties = new HashMap<>(); 52 | mi.properties.put("user-agent", 53 | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36"); 54 | mi.properties.put("referer", "https://www.bilibili.com/"); 55 | return mi; 56 | } 57 | 58 | @Override 59 | public MusicInfo getId(String id) throws Exception { 60 | throw new UnsupportedOperationException("暂不支持"); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/musicsource/KugouMusicSource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.musicsource; 19 | 20 | import com.google.gson.JsonObject; 21 | import com.google.gson.JsonParser; 22 | import com.khjxiaogu.MiraiSongPlugin.HttpRequestBuilder; 23 | import com.khjxiaogu.MiraiSongPlugin.MusicInfo; 24 | import com.khjxiaogu.MiraiSongPlugin.MusicSource; 25 | import com.khjxiaogu.MiraiSongPlugin.Utils; 26 | 27 | public class KugouMusicSource implements MusicSource { 28 | final static String COOKIE = "kg_mid=30f1713c23ab7bb496ab035b07dae834; ACK_SERVER_10015=%7B%22list%22%3A%5B%5B%22bjlogin-user.kugou.com%22%5D%5D%7D; ACK_SERVER_10016=%7B%22list%22%3A%5B%5B%22bjreg-user.kugou.com%22%5D%5D%7D; ACK_SERVER_10017=%7B%22list%22%3A%5B%5B%22bjverifycode.service.kugou.com%22%5D%5D%7D; Hm_lvt_aedee6983d4cfc62f509129360d6bb3d=1598198881; kg_dfid=1HZmYL0ngIYp0uu93N2m4s5P; kg_dfid_collect=d41d8cd98f00b204e9800998ecf8427e; Hm_lpvt_aedee6983d4cfc62f509129360d6bb3d=1598199021"; 29 | 30 | public KugouMusicSource() { 31 | } 32 | 33 | @Override 34 | public MusicInfo get(String keyword) throws Exception { 35 | keyword=Utils.urlEncode(keyword); 36 | JsonObject je = JsonParser 37 | .parseString(HttpRequestBuilder.create("http","msearchcdn.kugou.com") 38 | .url("/api/v3/search/song?showtype=14&highlight=em&pagesize=1&tag_aggr=1&tagtype=%E5%85%A8%E9%83%A8&plat=0&sver=5&correct=1&api_ver=1&version=9108&page=1&area_code=1&tag=1&with_res_tag=1&keyword=") 39 | .url(keyword) 40 | .get().readString().replaceAll("", "")) 41 | .getAsJsonObject(); 42 | String song = je.get("data").getAsJsonObject().get("info").getAsJsonArray().get(0).getAsJsonObject().get("hash") 43 | .getAsString(); 44 | String album_id = je.get("data").getAsJsonObject().get("info").getAsJsonArray().get(0).getAsJsonObject() 45 | .get("album_id").getAsString(); 46 | JsonObject info = HttpRequestBuilder.create("wwwapi.kugou.com") 47 | .url("/yy/index.php?r=play/getdata&hash=") 48 | .url(song) 49 | .url("&album_id=") 50 | .url(album_id) 51 | .url("&_=") 52 | .url(String.valueOf(Utils.getTime())) 53 | .cookie(COOKIE) 54 | .get().readJson().get("data").getAsJsonObject(); 55 | return new MusicInfo(info.get("audio_name").getAsString(), info.get("author_name").getAsString(), 56 | info.get("img").getAsString(), info.get("play_url").getAsString(), 57 | "https://www.kugou.com/song/#hash=" + song + "&album_id=" + info.get("album_id").getAsString(), "酷狗","",205141); 58 | } 59 | 60 | @Override 61 | public MusicInfo getId(String id) throws Exception { 62 | throw new UnsupportedOperationException("暂不支持"); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/musicsource/LocalFileSource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.musicsource; 19 | 20 | import java.io.FileReader; 21 | 22 | import com.google.gson.JsonArray; 23 | import com.google.gson.JsonElement; 24 | import com.google.gson.JsonObject; 25 | import com.google.gson.JsonParser; 26 | import com.khjxiaogu.MiraiSongPlugin.MusicInfo; 27 | import com.khjxiaogu.MiraiSongPlugin.MusicSource; 28 | import com.khjxiaogu.MiraiSongPlugin.Utils; 29 | 30 | public class LocalFileSource implements MusicSource { 31 | public static boolean autoLocal = false; 32 | 33 | @Override 34 | public boolean isVisible() { 35 | return autoLocal; 36 | } 37 | 38 | public LocalFileSource() { 39 | } 40 | 41 | String forceGetJsonString(JsonObject jo, String member) { 42 | return forceGetJsonString(jo, member, ""); 43 | } 44 | 45 | String forceGetJsonString(JsonObject jo, String member, String def) { 46 | if (jo.has(member)) 47 | return jo.get(member).getAsString(); 48 | return def; 49 | } 50 | 51 | @Override 52 | public MusicInfo get(String keyword) throws Exception { 53 | try(FileReader fr=new FileReader("SongPluginLocal.json")){ 54 | JsonArray localfs = JsonParser.parseReader(fr).getAsJsonArray(); 55 | 56 | JsonObject result = null; 57 | double min = Integer.MAX_VALUE; 58 | for (JsonElement je : localfs) { 59 | JsonObject cur = je.getAsJsonObject(); 60 | String ckw = forceGetJsonString(cur, "title"); 61 | double curm = Utils.compare(keyword, ckw); 62 | if (curm < min) { 63 | min = curm; 64 | result = cur; 65 | } 66 | } 67 | 68 | return new MusicInfo(forceGetJsonString(result, "title"), forceGetJsonString(result, "desc"), 69 | forceGetJsonString(result, "previewUrl"), forceGetJsonString(result, "musicUrl"), 70 | forceGetJsonString(result, "jumpUrl"), forceGetJsonString(result, "source", "本地")); 71 | } 72 | } 73 | 74 | @Override 75 | public MusicInfo getId(String id) throws Exception { 76 | throw new UnsupportedOperationException("暂不支持"); 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/musicsource/NetEaseAdvancedRadio.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.musicsource; 19 | 20 | import com.khjxiaogu.MiraiSongPlugin.MusicInfo; 21 | import com.khjxiaogu.MiraiSongPlugin.Utils; 22 | 23 | public class NetEaseAdvancedRadio extends NetEaseRadioSource { 24 | 25 | @Override 26 | public MusicInfo get(String keyword) throws Exception { 27 | String rkw = keyword; 28 | int pos = rkw.indexOf('|'); 29 | if (pos != -1) { 30 | String radio = rkw.substring(0, pos); 31 | String song = rkw.substring(pos + 1); 32 | if (song.length() > 0 && radio.length() > 0) 33 | return super.get(Utils.urlEncode(radio), song); 34 | } 35 | return super.get(keyword); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/musicsource/NetEaseHQMusicSource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.musicsource; 19 | 20 | import com.google.gson.JsonArray; 21 | import com.google.gson.JsonObject; 22 | import com.khjxiaogu.MiraiSongPlugin.HttpRequestBuilder; 23 | import com.khjxiaogu.MiraiSongPlugin.JsonBuilder; 24 | import com.khjxiaogu.MiraiSongPlugin.NetEaseCrypto; 25 | 26 | public class NetEaseHQMusicSource extends NetEaseMusicSource { 27 | 28 | public NetEaseHQMusicSource() { 29 | } 30 | 31 | @Override 32 | public String queryRealUrl(String id) throws Exception { 33 | 34 | JsonObject main = HttpRequestBuilder.create("music.163.com") 35 | .url("/weapi/song/enhance/player/url?csrf_token=") 36 | .contenttype("application/x-www-form-urlencoded") 37 | .referer("https://music.163.com") 38 | .cookie(NetEaseCrypto.cookie) 39 | .ua(NetEaseCrypto.getUserAgent()) 40 | .post() 41 | .send(NetEaseCrypto.weapiEncryptParam(JsonBuilder.object().add("ids","[" + id + "]").add("br",999000).toString())) 42 | .readJson(); 43 | if (main.get("code").getAsInt() == 200) { 44 | JsonArray data = main.get("data").getAsJsonArray(); 45 | JsonObject song = data.get(0).getAsJsonObject(); 46 | if (song.get("code").getAsInt() == 200) { 47 | return song.get("url").getAsString().trim(); 48 | } 49 | } 50 | return null; 51 | } 52 | 53 | @Override 54 | public boolean isVisible() { 55 | return false; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/musicsource/NetEaseMusicSource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.musicsource; 19 | 20 | import com.google.gson.JsonArray; 21 | import com.google.gson.JsonObject; 22 | import com.khjxiaogu.MiraiSongPlugin.HttpRequestBuilder; 23 | import com.khjxiaogu.MiraiSongPlugin.JsonBuilder; 24 | import com.khjxiaogu.MiraiSongPlugin.MusicInfo; 25 | import com.khjxiaogu.MiraiSongPlugin.MusicSource; 26 | import com.khjxiaogu.MiraiSongPlugin.NetEaseCrypto; 27 | import com.khjxiaogu.MiraiSongPlugin.Utils; 28 | 29 | public class NetEaseMusicSource implements MusicSource { 30 | 31 | public NetEaseMusicSource() { 32 | } 33 | 34 | public String queryRealUrl(String id) throws Exception { 35 | return "http://music.163.com/song/media/outer/url?id=" + id + ".mp3"; 36 | } 37 | 38 | 39 | @Override 40 | public MusicInfo get(String keyword) throws Exception { 41 | String murl; 42 | JsonObject jom=HttpRequestBuilder.create("music.163.com") 43 | .url("/weapi/cloudsearch/get/web?csrf_token=") 44 | .referer("http://music.163.com/") 45 | .cookie("appver=1.5.0.75771;"+NetEaseCrypto.cookie) 46 | .contenttype("application/x-www-form-urlencoded") 47 | .post() 48 | .send(NetEaseCrypto.weapiEncryptParam(JsonBuilder.object().add("s", keyword).add("type", 1).add("offset", 0).add("limit", 3).toString())) 49 | .readJson(); 50 | JsonArray ja=jom 51 | .get("result").getAsJsonObject().get("songs").getAsJsonArray(); 52 | JsonObject jo = ja.get(0).getAsJsonObject(); 53 | murl = queryRealUrl(jo.get("id").getAsString()); 54 | int i = 0; 55 | while (!Utils.isExistent(murl)) { 56 | jo = ja.get(++i).getAsJsonObject(); 57 | murl = queryRealUrl(jo.get("id").getAsString()); 58 | } 59 | return new MusicInfo(jo.get("name").getAsString(), 60 | jo.get("ar").getAsJsonArray().get(0).getAsJsonObject().get("name").getAsString(), 61 | jo.get("al").getAsJsonObject().get("picUrl").getAsString(), murl, 62 | "https://y.music.163.com/m/song?id=" + jo.get("id").getAsString(), "网易云音乐", "", 100495085); 63 | } 64 | 65 | @Override 66 | public MusicInfo getId(String id) throws Exception { 67 | String murl; 68 | JsonObject jo =HttpRequestBuilder.create("music.163.com") 69 | .url("/weapi/song/detail?csrf_token=") 70 | .referer("http://music.163.com/") 71 | .cookie("appver=1.5.0.75771;"+NetEaseCrypto.cookie) 72 | .contenttype("application/x-www-form-urlencoded") 73 | .post() 74 | .send(NetEaseCrypto.weapiEncryptParam(JsonBuilder.object().array("ids").add(id).end().toString())) 75 | .readJson() 76 | .get("songs").getAsJsonArray() 77 | .get(0).getAsJsonObject(); 78 | murl = queryRealUrl(id); 79 | return new MusicInfo(jo.get("name").getAsString(), 80 | jo.get("artists").getAsJsonArray().get(0).getAsJsonObject().get("name").getAsString(), 81 | jo.get("album").getAsJsonObject().get("picUrl").getAsString(), murl, 82 | "https://y.music.163.com/m/song?id=" + jo.get("id").getAsString(), "网易云音乐", "", 100495085); 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/musicsource/XimalayaSource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.musicsource; 19 | 20 | import com.google.gson.JsonArray; 21 | import com.google.gson.JsonObject; 22 | import com.khjxiaogu.MiraiSongPlugin.HttpRequestBuilder; 23 | import com.khjxiaogu.MiraiSongPlugin.MusicInfo; 24 | import com.khjxiaogu.MiraiSongPlugin.MusicSource; 25 | import com.khjxiaogu.MiraiSongPlugin.Utils; 26 | 27 | public class XimalayaSource implements MusicSource { 28 | 29 | @Override 30 | public MusicInfo get(String keyword) throws Exception { 31 | JsonArray ja =HttpRequestBuilder.create("www.ximalaya.com") 32 | .url("/revision/search/main?page=1&spellchecker=true&paidFilter=true&condition=relation&rows=10&device=iPhone&core=track&kw=") 33 | .url(Utils.urlEncode(keyword)) 34 | 35 | .get() 36 | .readJson() 37 | .get("data").getAsJsonObject() 38 | .get("track").getAsJsonObject() 39 | .get("docs").getAsJsonArray(); 40 | JsonObject song; 41 | int i=-1; 42 | do { 43 | song=ja.get(++i).getAsJsonObject(); 44 | }while(song.get("isPaid").getAsBoolean()); 45 | String path=HttpRequestBuilder.create("www.ximalaya.com") 46 | .url("/tracks/") 47 | .url(song.get("id").getAsString()) 48 | .url(".json") 49 | .get() 50 | .readJson().get("play_path").getAsString(); 51 | 52 | return new MusicInfo(song.get("title").getAsString(),song.get("nickname").getAsString(),"https:"+song.get("coverPath").getAsString(),path,"https://www.ximalaya.com"+song.get("trackUrl").getAsString(),"喜马拉雅"); 53 | } 54 | 55 | @Override 56 | public MusicInfo getId(String id) throws Exception { 57 | JsonObject out=HttpRequestBuilder.create("www.ximalaya.com") 58 | .url("/tracks/") 59 | .url(id) 60 | .url(".json") 61 | .get() 62 | .readJson(); 63 | return new MusicInfo(out.get("title").getAsString(), 64 | String.valueOf(out.get("nickname")), 65 | out.get("cover_url").getAsString(), 66 | out.get("play_path").getAsString(), 67 | "https://www.ximalaya.com/sound/"+id, 68 | "喜马拉雅"); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/permission/FriendMatcher.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.permission; 19 | 20 | import java.util.Arrays; 21 | import java.util.List; 22 | 23 | public class FriendMatcher implements PermissionMatcher { 24 | PermissionResult result; 25 | @Override 26 | public PermissionResult match(MatchInfo info) { 27 | if(info.bot.getFriend(info.callerid)!=null) 28 | return result; 29 | return PermissionResult.UNSPECIFIED; 30 | } 31 | public FriendMatcher(PermissionResult result) { 32 | this.result = result; 33 | } 34 | public FriendMatcher(boolean result) { 35 | this(PermissionResult.valueOf(result)); 36 | } 37 | 38 | @Override 39 | public List getValue() { 40 | return Arrays.asList(result.getSymbol()+"friend"); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/permission/GroupMatcher.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.permission; 19 | 20 | import java.util.ArrayList; 21 | import java.util.LinkedHashMap; 22 | import java.util.List; 23 | import java.util.Map; 24 | import java.util.Map.Entry; 25 | import java.util.concurrent.ConcurrentHashMap; 26 | 27 | import com.khjxiaogu.MiraiSongPlugin.permission.CommandMatcher.PermissionFactory; 28 | 29 | public class GroupMatcher implements PermissionMatcher { 30 | PermissionResult wildcard=PermissionResult.UNSPECIFIED; 31 | LinkedHashMap restricted=new LinkedHashMap<>(5); 32 | Map memberpermissions=new ConcurrentHashMap<>(10); 33 | 34 | @Override 35 | public PermissionResult match(MatchInfo info) { 36 | PermissionResult pr=wildcard; 37 | for(PermissionMatcher sp:restricted.values()) { 38 | pr=pr.and(sp.match(info)); 39 | } 40 | pr=pr.and(memberpermissions.getOrDefault(info.callerid,PermissionResult.UNSPECIFIED)); 41 | return pr; 42 | } 43 | public List getValue(){ 44 | List pl=new ArrayList<>(); 45 | if(wildcard!=PermissionResult.UNSPECIFIED) 46 | pl.add(wildcard.getSymbol()+"*"); 47 | for(PermissionMatcher sp:restricted.values()) 48 | pl.addAll(sp.getValue()); 49 | for(Entry i:memberpermissions.entrySet()) { 50 | pl.add(i.getValue().getSymbol()+i.getKey().toString()); 51 | } 52 | return pl; 53 | } 54 | boolean load(String param) { 55 | if(param.length()==0)return false; 56 | char isr=param.charAt(0); 57 | if(Character.isDigit(isr)) { 58 | memberpermissions.put(Long.parseLong(param),PermissionResult.DISALLOW); 59 | return true; 60 | } 61 | boolean result=false; 62 | String s; 63 | switch(isr) { 64 | case '#':return false; 65 | case '+':result=true;s=param.substring(1);break; 66 | case '-':s=param.substring(1);break; 67 | default:s=param;break; 68 | } 69 | if(Character.isDigit(s.charAt(0))) { 70 | memberpermissions.put(Long.parseLong(s),PermissionResult.valueOf(result)); 71 | return true; 72 | }else if(s.charAt(0)=='*') { 73 | wildcard=PermissionResult.valueOf(result); 74 | return true; 75 | }else { 76 | PermissionFactory pf=Matchers.get(s); 77 | if(pf!=null) { 78 | restricted.put(s,pf.create(result)); 79 | return true; 80 | } 81 | } 82 | return false; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/permission/MatchInfo.java: -------------------------------------------------------------------------------- 1 | package com.khjxiaogu.MiraiSongPlugin.permission; 2 | 3 | import net.mamoe.mirai.Bot; 4 | import net.mamoe.mirai.contact.Member; 5 | import net.mamoe.mirai.contact.User; 6 | 7 | public class MatchInfo { 8 | Bot bot; 9 | long callerid; 10 | long groupid; 11 | String cmd; 12 | boolean isTemp; 13 | boolean mustMatchCommand; 14 | public MatchInfo() { 15 | } 16 | public MatchInfo(String cmd,long memberid,long groupid,Bot bot) { 17 | super(); 18 | this.bot = bot; 19 | this.callerid = memberid; 20 | this.groupid = groupid; 21 | this.cmd = cmd; 22 | } 23 | public MatchInfo(String cmd,Member m) { 24 | this(cmd,m.getId(),m.getGroup().getId(),m.getBot()); 25 | } 26 | 27 | public MatchInfo(String cmd,User u,boolean temp) { 28 | this(cmd,u.getId(),0,u.getBot()); 29 | this.isTemp=temp; 30 | } 31 | public MatchInfo mustMatchCommand() { 32 | mustMatchCommand=true; 33 | return this; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/permission/Matchers.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.permission; 19 | 20 | import java.util.HashMap; 21 | import java.util.Map; 22 | 23 | import com.khjxiaogu.MiraiSongPlugin.permission.CommandMatcher.PermissionFactory; 24 | 25 | public class Matchers { 26 | static Map subfactories=new HashMap<>(); 27 | static { 28 | subfactories.put("admins",is->new MemberPermissionMatcher(WildcardPermission.admins,is)); 29 | subfactories.put("friend",is->new FriendMatcher(is)); 30 | subfactories.put("admin",is->new MemberPermissionMatcher(WildcardPermission.admin,is)); 31 | subfactories.put("owner",is->new MemberPermissionMatcher(WildcardPermission.owner,is)); 32 | subfactories.put("member",is->new MemberPermissionMatcher(WildcardPermission.member,is)); 33 | subfactories.put("stranger",is->new StrangerMatcher(is)); 34 | } 35 | public static PermissionMatcher create(String s,boolean result) { 36 | PermissionFactory pf=subfactories.get(s); 37 | if(pf!=null) 38 | return pf.create(result); 39 | return null; 40 | } 41 | public static PermissionFactory get(String s) { 42 | return subfactories.get(s); 43 | } 44 | public static PermissionFactory getWC(String s) { 45 | return subfactories.get(s); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/permission/MemberPermissionMatcher.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.permission; 19 | 20 | import java.util.Arrays; 21 | import java.util.List; 22 | 23 | import net.mamoe.mirai.contact.Group; 24 | import net.mamoe.mirai.contact.Member; 25 | 26 | public class MemberPermissionMatcher implements PermissionMatcher { 27 | PermissionResult result; 28 | WildcardPermission perm; 29 | @Override 30 | public PermissionResult match(MatchInfo info) { 31 | if(info.groupid==0)return PermissionResult.UNSPECIFIED; 32 | Group g=info.bot.getGroup(info.groupid); 33 | if(g!=null) { 34 | try { 35 | Member m=g.get(info.callerid); 36 | if(m!=null) 37 | return (perm.isMatch(m.getPermission())?result:PermissionResult.UNSPECIFIED); 38 | }catch(Exception ignored) {} 39 | } 40 | return PermissionResult.UNSPECIFIED; 41 | } 42 | 43 | 44 | public MemberPermissionMatcher(WildcardPermission perm,PermissionResult result) { 45 | this.perm=perm; 46 | this.result = result; 47 | } 48 | public MemberPermissionMatcher(WildcardPermission perm,boolean result) { 49 | this(perm,PermissionResult.valueOf(result)); 50 | } 51 | 52 | @Override 53 | public List getValue() { 54 | return Arrays.asList(result.getSymbol()+perm.name()); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/permission/NullOperationMatcher.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.permission; 19 | 20 | import java.util.Arrays; 21 | import java.util.List; 22 | 23 | public final class NullOperationMatcher implements PermissionMatcher { 24 | public static final NullOperationMatcher INSTANCE=new NullOperationMatcher(); 25 | 26 | @Override 27 | public PermissionResult match(MatchInfo info) { 28 | return PermissionResult.UNSPECIFIED; 29 | } 30 | @Override 31 | public List getValue() { 32 | return Arrays.asList("#"); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/permission/PermissionMatcher.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.permission; 19 | 20 | import java.util.List; 21 | 22 | public interface PermissionMatcher { 23 | PermissionResult match(MatchInfo info); 24 | 25 | List getValue(); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/permission/PermissionResult.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.permission; 19 | 20 | public enum PermissionResult { 21 | ALLOW(true,"+"),UNSPECIFIED(true,null),DISALLOW(false,"-"); 22 | private final boolean allow; 23 | private final String symbol; 24 | private PermissionResult(boolean allow,String symbol) { 25 | this.allow = allow; 26 | this.symbol=symbol; 27 | } 28 | public String getSymbol() { 29 | return symbol; 30 | } 31 | public static PermissionResult valueOf(boolean b) { 32 | if(b)return ALLOW; 33 | return DISALLOW; 34 | } 35 | public boolean isAllowed() { 36 | return allow; 37 | } 38 | public boolean isForceAllowed() { 39 | return this==ALLOW; 40 | } 41 | public PermissionResult and(PermissionResult oth) { 42 | if(oth==UNSPECIFIED) 43 | return this; 44 | return oth; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/permission/QQMatcher.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.permission; 19 | 20 | import java.util.Arrays; 21 | import java.util.List; 22 | 23 | public class QQMatcher implements PermissionMatcher { 24 | PermissionResult result; 25 | long qq; 26 | @Override 27 | public PermissionResult match(MatchInfo info) { 28 | if(info.callerid==qq) 29 | return result; 30 | return PermissionResult.UNSPECIFIED; 31 | } 32 | public QQMatcher(long qq,PermissionResult result) { 33 | this.result = result; 34 | this.qq=qq; 35 | } 36 | public QQMatcher(long qq,boolean result) { 37 | this(qq,PermissionResult.valueOf(result)); 38 | } 39 | @Override 40 | public List getValue() { 41 | return Arrays.asList(result.getSymbol()+String.valueOf(qq)); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/permission/StrangerMatcher.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.permission; 19 | 20 | import java.util.Arrays; 21 | import java.util.List; 22 | 23 | public class StrangerMatcher implements PermissionMatcher { 24 | PermissionResult result; 25 | @Override 26 | public PermissionResult match(MatchInfo info) { 27 | if(info.isTemp||info.bot.getFriend(info.callerid)==null) { 28 | return result; 29 | } 30 | return PermissionResult.UNSPECIFIED; 31 | } 32 | 33 | 34 | public StrangerMatcher(PermissionResult result) { 35 | this.result = result; 36 | } 37 | public StrangerMatcher(boolean result) { 38 | this(PermissionResult.valueOf(result)); 39 | } 40 | 41 | @Override 42 | public List getValue() { 43 | return Arrays.asList(result.getSymbol()+"stranger"); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/khjxiaogu/MiraiSongPlugin/permission/WildcardPermission.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Mirai Song Plugin 3 | * Copyright (C) 2021 khjxiaogu 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.khjxiaogu.MiraiSongPlugin.permission; 19 | 20 | import java.util.function.Predicate; 21 | 22 | import net.mamoe.mirai.contact.MemberPermission; 23 | 24 | public enum WildcardPermission { 25 | admin(m->m==MemberPermission.ADMINISTRATOR), 26 | admins(m->m!=MemberPermission.MEMBER), 27 | owner(m->m==MemberPermission.OWNER), 28 | member(m->m==MemberPermission.MEMBER), 29 | members(m->true); 30 | private final Predicate matcher; 31 | 32 | private WildcardPermission(Predicate matcher) { 33 | this.matcher = matcher; 34 | } 35 | public boolean isMatch(MemberPermission mp) { 36 | return matcher.test(mp); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/services/net.mamoe.mirai.console.plugin.jvm.JvmPlugin: -------------------------------------------------------------------------------- 1 | ${project.groupId}.${project.artifactId}.${project.artifactId} -------------------------------------------------------------------------------- /src/main/resources/config.yml: -------------------------------------------------------------------------------- 1 | ffmpeg_path: "ffmpeg" 2 | silkenc_path: "silk_v3_encoder" 3 | adddefault: true 4 | amrqualityshift: false 5 | amrwb: true 6 | use_custom_ffmpeg_command: false 7 | custom_ffmpeg_command: "ffmpeg -i %input% -ab 23.85k -ar 16000 -ac 1 -acodec amr_wb -y %output%" 8 | enable_local: false 9 | verbose: true 10 | hintsongnotfound: "无法找到歌曲。" 11 | hintcarderror: "分享歌曲失败。" 12 | hintnotemplate: "无法找到卡片。" 13 | hintsourcenotfound: "无法找到来源。" 14 | enableParser: 1 15 | admins: 16 | - 0 17 | neteasecookies: MUSIC_U=; 18 | extracommands: 19 | "#分享": 20 | source: all 21 | card: Share 22 | 23 | --------------------------------------------------------------------------------