var rescanCustomString = "remoteuser@remotebox"; function reload() { Process.execute(['killall', '-HUP', 'museekd'], ''); } function rescan() { Process.execute('muscan', ''); } function musetup() { Process.execute(['xterm', '-fg', 'white', '-bg', 'black', '-e', 'musetup'], ''); } function remote_musetup() { Process.execute(['xterm', '-fg', 'white', '-bg', 'black', '-e', 'ssh', '-t', rescanCustomString, 'musetup'], ''); } function rescanHelp() { MessageBox.information("Rescanning Museek's shares is actually a two-part process\n\nFirst 'Rescan files' (with muscan)\nThen run 'Reload shares' (which will issue a 'killall -HUP museekd')\n\nRemotely rescan/reload shares will issue a SSH command to the computer\nyou choose via the 'Set SSH username@hostname' menu item in the Settings menu.\n\nSSH autologin will have to be enabled already.\n(You need your local computer's public ssh key in your Museekd computer's ~/.ssh/authorized_keys file.\n\nThis is a security risk, but since it's also the Ultimate in ease-of-use I'm rather careless :)", MessageBox.Ok); } function rescanCheck() { if(! Museeq.connected) { MessageBox.warning("You need to be connected to museekd to do this", MessageBox.Ok, MessageBox.NoButton); return 0; } return 1; } function setCustom() { if(rescanCheck() == 0) return; var string = Input.getText("Set the 'username@hostname/IP' for the remote ssh commands:", rescanCustomString, "SSH to:"); if(string) { Museeq.setConfig("QSArescan", "customString", string); } } function rescanCustom() { Process.execute(['ssh', rescanCustomString, 'muscan']); } function reloadCustom() { Process.execute(['ssh', rescanCustomString, 'killall', '-HUP', 'museekd']); } function ignored_users() { Process.execute(['museek-users.py', '-ix']); } function banned_users() { Process.execute(['museek-users.py', '-bx']); } function buddied_users() { Process.execute(['museek-users.py', '-ux']); } function remote_ignored_users() { Process.execute(['xterm', '-fg', 'white', '-bg', 'black', '-e', 'ssh', '-t', rescanCustomString, 'museek-users.py', '-is', '|', 'less']); } function remote_banned_users() { Process.execute(['xterm', '-fg', 'white', '-bg', 'black', '-e', 'ssh', '-t', rescanCustomString, 'museek-users.py', '-bs', '|', 'less']); } function remote_buddied_users() { Process.execute(['xterm', '-fg', 'white', '-bg', 'black', '-e', 'ssh', '-t', rescanCustomString, 'museek-users.py', '-us', '|', 'less']); } function rescanConfigChanged(domain, key, value) { if(domain == "QSArescan") { if(key == "customString") rescanCustomString = value; } } function init() { value = config("QSArescan", "customString"); if(value) rescanCustomString = value; connect(Museeq, "configChanged(const QString&,const QString&,const QString&)", rescanConfigChanged); addMenu("Rescan", "Rescan files", "rescan"); addMenu("Rescan", "Reload shares database", "reload"); addMenu("Rescan", "Help", "rescanHelp"); addMenu("Settings", "Run Musetup (Term)", "musetup"); addMenu("Settings", "Ignored users", "ignored_users"); addMenu("Settings", "Buddied users", "buddied_users"); addMenu("Settings", "Banned users", "banned_users"); addMenu("Remote", "Set SSH username@hostname", "setCustom"); addMenu("Remote", "Remotely rescan files (SSH)", "rescanCustom"); addMenu("Remote", "Remotely reload shares (SSH)", "reloadCustom"); addMenu("Remote", "Remote Musetup (SSH Term)", "remote_musetup"); addMenu("Remote", "Remote Ignored users", "remote_ignored_users"); addMenu("Remote", "Remote Buddied users", "remote_buddied_users"); addMenu("Remote", "Remote Banned users", "remote_banned_users"); return "Rescan"; }