Eisa01 / mpv-scripts

This repository contain scripts I have made for mpv media player...
BSD 2-Clause "Simplified" License
557 stars 37 forks source link

Option to change log file location #23

Closed dyphire closed 2 years ago

dyphire commented 3 years ago

Portable mpv installation uses portable_config folder in the root of mpv installation for storing personal data.When using multiple mpv, scripts are required to adapt the portability configuration, such as using mpv and mpv.net at the same time.Thanks in advance.

Eisa01 commented 3 years ago

If it's mpv and there is a scripts directory for it, it should work. Do you mean you want to change the log file location for each script? So that MPV.net uses different log director and MPV uses a different one?

dyphire commented 3 years ago

If it's mpv and there is a scripts directory for it, it should work. Do you mean you want to change the log file location for each script? So that MPV.net uses different log director and MPV uses a different one?

I mean, log files can be saved in portable_config instead of appdata for Windows. In this way, there is no need to worry about conflicts between different MPV clients, because each MPV can have its own portable_config Please refer to the official documentation:files-on-windows

dyphire commented 3 years ago

As for the specific implementation method, I think it isn't necessary to detect the path of appdata or home, but the upper folder where the script is located?

I find this script implements a similar function: recent.lua

Eisa01 commented 3 years ago

Ah so u mean the optional configuration parameters, not the logging. This is possible to implement. However, it required additional mpv dependencies and files. I tried to keep it clean.

The portable configuration, is actually inside the script itself. You can open the script with a notepad and you will find a user customization section where u can change stuff.

Is there any specific parameter you need to change but didn't find it?

dyphire commented 3 years ago

Ah so u mean the optional configuration parameters, not the logging. This is possible to implement. However, it required additional mpv dependencies and files. I tried to keep it clean.

The portable configuration, is actually inside the script itself. You can open the script with a notepad and you will find a user customization section where u can change stuff.

Is there any specific parameter you need to change but didn't find it?

Sorry, I can't find the option to change the *.log path in the user customization section. Can you tell me how to do it? How to put *.log in portable_config without absolute path?

Eisa01 commented 3 years ago

I didn't make the option to change the log file location, ill make it next update. Which script are you using?

dyphire commented 3 years ago

I didn't make the option to change the log file location, ill make it next update. Which script are you using?

I'm using UndoRedo.lua,SmartHistory.lua and SmartCopyPaste-II.lua. Thank you for everything

dyphire commented 3 years ago

I found a solution for reference

change

local copyLog = (os.getenv('APPDATA') or os.getenv('HOME')..'/.config')..'/mpv/mpvClipboard.log'
local historyLog = (os.getenv('APPDATA') or os.getenv('HOME')..'/.config')..'/mpv/mpvHistory.log'

to

local copyLog = mp.find_config_file(".") .. "/" .. 'mpvClipboard.log'
local historyLog = mp.find_config_file(".") .. "/" .. 'mpvHistory.log'

This enables script log generation in portable_config

Eisa01 commented 3 years ago

Nice work, you digged inside the script and changed the path. I'll keep this ticket open until I make it easy for others by putting the option above.

dyphire commented 2 years ago

I noticed that you updated these scripts recently. For windows, the new path is in mpv.exe works normally. but it is broken in libmpv, such as mpv.net.

I tried the following modifications to fix, it works Example: change

local copyLogPath = mp.find_config_file("."):match("@?(.*/)")
local copyLog = copyLogPath .. copyLogFile

to

local copyLogPath = mp.find_config_file(".")
local copyLog = copyLogPath ..'/'.. copyLogFile
Eisa01 commented 2 years ago

Ah I see, appreciated I'll reflect in the new major version. I am rewriting most of the scripts to include new useful enhancements and customizable options for almost everything.

Eisa01 commented 2 years ago

for SmartCopyPaste 3.0 version is released along with its config file. It covers these optional features and tons more. For history, SmartHistory has been depreciated and replaced with SimpleHistory 1.0. It also covers this and tons more. You can confirm from your side so we close this.