Comments (5)
It should be completely async. I dig into this.
from mympd.
I can not reproduce your issue. I used following script:
mympd.init()
mympd.log(4, "Skript " .. mympd_arguments.nr)
return "Skript " .. mympd_arguments.nr
However I added some code in devel that could fix your issue.
from mympd.
Yes, with two scripts/triggers, containing only mympd.init() and one api call mympd.api("MYMPD_API_PLAYER_CURRENT_SONG") there is no error. Here are my 2 simple scripts, with which I can reproduce error:
test_init_1.lua:
-- {"order":1,"file":"","version":0,"arguments":["trigger"]}
print("test_init_1 begin")
mympd.init()
local play_state = mympd_state.play_state
local elapsed_time = mympd_state.elapsed_time
if play_state ~= 2 or elapsed_time > 5 then
print("test_init_1 not playing")
return "test_init_1 not playing"
end
local rc, result = mympd.api("MYMPD_API_PLAYER_CURRENT_SONG")
if rc ~= 0 then
print("test_init_1 current song error")
return "test_init_1 current song error"
end
print("test_init_1", result.uri)
print("test_init_1 end")
return "test_init_1 return"
test_init_2.lua:
-- {"order":1,"file":"","version":0,"arguments":["trigger"]}
print("test_init_2 begin")
function mympd_set_variable(p_key, p_value)
print("mympd_set_variable " .. p_key .. "=" .. p_value)
mympd.api("MYMPD_API_SCRIPT_VAR_SET", { key = p_key, value = tostring(p_value) })
end
mympd.init()
local play_state = mympd_state.play_state
local elapsed_time = mympd_state.elapsed_time
local song_pos = mympd_state.song_pos
if play_state ~= 2 or elapsed_time > 5 then
print("test_init_2 not playing")
return "test_init_2 not playing"
end
if play_state == 2 and song_pos > 0 and mympd_env.var_playlist_current_playlist then
print("playing stored playlist " .. song_pos)
mympd_set_variable("test", song_pos)
end
print("test_init_2 end")
return "test_init_2 return"
of course assuming that mympd_env.var_playlist_current_playlist exists
then script 1 ends with error
I will try devel branch a bit later
from mympd.
I confirm, on devel branch there is no error with my test scripts and with my real scripts
no_error.log
from mympd.
Great!
from mympd.
Related Issues (20)
- Dialog functionality for scripts
- WAV Files - No "AlbumArtist" tag?
- Update mongoose to 7.14
- Add caches
- Precompile integrated lua libraries
- Rework http_client
- music directory not found HOT 16
- AlbumArtist tag question (bug ?)
- Remove radiobrowser integration
- cache_cover_keep_days & mympd-config HOT 17
- Image carousel not displayed on click on cover in footer and playback view
- Build fails without luac HOT 2
- Return redirect to not-available image if no tagart was found
- Conversion bug for old OpenSSL releases
- Import old webradio favorites in new backend
- mympd-script: no params.event
- Feat: API to reload script from disk
- Browse by Composer->Album Empty List HOT 2
- database updates with special characters HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mympd.