代码拉取完成,页面将自动刷新
//
// Created by Txwh on 2022/1/7.
//
#include "MT_info_get.h"
Netease_Music_info neteaseMusicInfo;
FileBasicInformation fileBasicInfo;
StartWithSystem startWithSystem;
MT_info_get::MT_info_get(QObject * parent) : QObject(parent){
std::string copy_file_path = "NE_history.json";
neteaseMusicInfo.NE_Copy_InfoFile(NE_path_get(), copy_file_path);
neteaseMusicInfo.GetInfoContent(copy_file_path);
//添加Hotkey
hotkey1 = new QHotkey(QKeySequence("Ctrl+1"), true);
if (hotkey1 != nullptr){
QObject::connect(hotkey1, &QHotkey::activated, this, &MT_info_get::hot_key_call_1);
}
}
std::string MT_info_get::NE_path_get() {
std::string home_path = getenv("HOMEPATH");
std::replace(home_path.begin(), home_path.end(), '\\', '/');
std::string disk_signal = "C:";
std::string path = disk_signal + home_path +
std::string("/AppData/Local/Netease/CloudMusic/webdata/file/history");
return path;
}
void MT_info_get::music_info_get() {
//这里music_info和player_info一般情况下是一起使用的,所以这里复制文件解析json后player_info_get()直接用
std::string copy_file_path = "NE_history.json";
neteaseMusicInfo.NE_Copy_InfoFile(NE_path_get(), copy_file_path);
neteaseMusicInfo.GetInfoContent(copy_file_path);
emit music_info_got(QString::fromStdString(neteaseMusicInfo.music_name));
}
void MT_info_get::img_download() {
neteaseMusicInfo.GetAlbumPhoto(neteaseMusicInfo.album_picUrl,"album.jpg");
}
void MT_info_get::player_info_get() {
emit player_info_got(QString::fromStdString(neteaseMusicInfo.artists_name));
}
void MT_info_get::NE_file_time() {
int64_t temp_time = fileBasicInfo.get_modificationTime(NE_path_get().c_str());
emit ne_file_time_got(QString::number(temp_time));
}
void MT_info_get::create_sws() {
std::string full_path = startWithSystem.get_programme_path();
int start_symbol = startWithSystem.start_with_system("MediaStateT", full_path);
}
void MT_info_get::check_start_with_system() {
std::string full_path = startWithSystem.get_programme_path();
int start_symbol = startWithSystem.sws_statue("MediaStateT", full_path);
if (start_symbol){
emit autostart_status(true);
}else{
emit autostart_status(false);
}
}
void MT_info_get::remove_sws() {
std::string full_path = startWithSystem.get_programme_path();
int start_symbol = startWithSystem.remove_sws("MediaStateT");
}
void MT_info_get::hot_key_call_1() {
emit hot_key_activated(1);
}
void MT_info_get::hot_key_call_2() {
emit hot_key_activated(2);
}
MT_info_get::~MT_info_get(){
delete hotkey1;
hotkey1 = nullptr;
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。