Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
build-x86_64:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
Expand All @@ -27,7 +27,7 @@ jobs:
path: debian/artifacts/*

build-arm64:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
Expand Down
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ qt_standard_project_setup()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/audiosource-base)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/audiosource-coordinator)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/audiosourcebluetooth)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/audiosourcepython)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/audiosourcecd)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/audiosourcefile)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/shared)
Expand All @@ -29,10 +29,10 @@ qt_add_executable(player WIN32 MACOSX_BUNDLE
src/audiosource-base/audiosource.h
src/audiosource-base/audiosourcewspectrumcapture.cpp
src/audiosource-base/audiosourcewspectrumcapture.h
src/audiosourcebluetooth/audiosourcebluetooth.cpp
src/audiosourcebluetooth/audiosourcebluetooth.h
src/audiosourcecd/audiosourcecd.cpp
src/audiosourcecd/audiosourcecd.h
src/audiosourcepython/audiosourcepython.cpp
src/audiosourcepython/audiosourcepython.h
src/audiosource-coordinator/audiosourcecoordinator.cpp
src/audiosource-coordinator/audiosourcecoordinator.h
src/audiosourcefile/audiosourcefile.cpp
Expand Down Expand Up @@ -87,6 +87,8 @@ qt_add_executable(player WIN32 MACOSX_BUNDLE
src/shared/fft.h
src/shared/util.cpp
src/shared/util.h
src/shared/linampslider.h
src/shared/linampslider.cpp
src/main.cpp
uiassets.qrc
)
Expand Down
61 changes: 61 additions & 0 deletions LICENSE-3RD-PARTY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# THIRD PARTY LICENCES

linamp-player includes the following third-party software/licensing:


## boxicons - https://boxicons.com/

The MIT License (MIT)

Copyright (c) 2015-2021 Aniket Suvarna

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


## decorator-operations debounce - https://github.com/salesforce/decorator-operations/blob/master/decoratorOperations/debounce_functions/debounce.py

Copyright (c) 2020, Salesforce.com, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


## RpiPythonCDPlayer - https://github.com/trybula/RpiPythonCDPlayer

GPL v3: https://github.com/trybula/RpiPythonCDPlayer/blob/main/LICENSE


## QtMixer - https://github.com/Znurre/QtMixer

GPL v2: https://github.com/Znurre/QtMixer/blob/master/LICENSE


## audacious fft.cc - https://github.com/audacious-media-player/audacious/blob/master/src/libaudcore/fft.cc

Copyright 2011 John Lindgren

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions, and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions, and the following disclaimer in the documentation
provided with the distribution.

This software is provided "as is" and without any warranty, express or
implied. In no event shall the authors be liable for any damages arising from
the use of this software.
Binary file added assets/menu-icon-x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/source-icon-bluetooth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/source-icon-cd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/source-icon-file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/source-icon-spotify.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
linamp (1.4.0) bookworm; urgency=medium

* Feature: Spotify Source, use Linamp as a Spotify Connect receiver
* UI: New design for Sources menu
* UI: Volume and balance sliders background color changes according to value
* Refactor: Unify Bluetooth and Spotify sources code as generic audiosourcepython

-- Rodrigo Méndez <rodrigo@linamp.org> Mon, 30 Dec 2024 12:04:00 -0600

linamp (1.3.0) bookworm; urgency=medium

* Feature: Bluetooth Source, use Linamp as a Bluetooth audio receiver
Expand Down
5 changes: 1 addition & 4 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ override_dh_auto_install:
cp build/player debian/linamp/usr/bin/linamp-player

mkdir -p debian/linamp/usr/lib/python3/dist-packages/linamp
cp python/linamp/__init__.py debian/linamp/usr/lib/python3/dist-packages/linamp/__init__.py
cp python/linamp/cdplayer.py debian/linamp/usr/lib/python3/dist-packages/linamp/cdplayer.py
cp -r python/linamp/baseplayer debian/linamp/usr/lib/python3/dist-packages/linamp/baseplayer
cp -r python/linamp/btplayer debian/linamp/usr/lib/python3/dist-packages/linamp/btplayer
cp -r python/linamp debian/linamp/usr/lib/python3/dist-packages/

mkdir -p debian/linamp/usr/share/applications/
cp linamp.desktop debian/linamp/usr/share/applications/
Expand Down
1 change: 1 addition & 0 deletions python/linamp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from linamp.cdplayer import *
from linamp.btplayer import *
from linamp.spotifyplayer import *
9 changes: 8 additions & 1 deletion python/linamp/baseplayer/baseplayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,14 @@ def get_message(self) -> tuple[bool, str, int]:
def clear_message(self) -> None:
pass

# -------- Polling functions to be called by a timer --------
# -------- Polling functions --------

# Called by the UI before calling getter to update the view (currently once each second)
# Return True if you want to request focus to this source
def poll_events(self) -> bool:
return False

# If your source requires asyncio or other event loop, run it here
# This will be run in a new thread when linamp starts
def run_loop(self):
pass
56 changes: 30 additions & 26 deletions python/linamp/btplayer/btadapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from dbus_next.aio import MessageBus
from dbus_next import BusType

loop = asyncio.get_event_loop()

SERVICE_NAME = 'org.bluez'
DEVICE_IFACE = SERVICE_NAME + '.Device1'
PLAYER_IFACE = SERVICE_NAME + '.MediaPlayer1'
Expand Down Expand Up @@ -72,11 +70,6 @@ def __str__(self):

return repr

def wait_for_loop() -> None:
"""Antipattern: waits the asyncio running loop to end"""
while loop.is_running():
pass

def is_empty_player_track(track: BTTrackInfo) -> bool:
return track.duration <= 0

Expand All @@ -101,8 +94,17 @@ class BTPlayerAdapter():
repeat = 'off'
shuffle = 'off'

loop = None

def __init__(self):
pass
self.loop = asyncio.new_event_loop()
asyncio.set_event_loop(self.loop)

def _wait_for_loop(self) -> None:
"""Antipattern: waits the asyncio running loop to end"""
asyncio.set_event_loop(self.loop)
while self.loop.is_running():
pass

async def _get_dbus_object(self, path):
introspection = await self.bus.introspect(SERVICE_NAME, path)
Expand Down Expand Up @@ -157,6 +159,8 @@ def print_state(self):

async def find_player(self):
"""Identify current player and device"""
if not self.manager:
return
objects = await self.manager.call_get_managed_objects()

player_path = None
Expand Down Expand Up @@ -226,56 +230,56 @@ async def find_player(self):
self.codec_configuration = None

def setup_sync(self):
wait_for_loop()
loop.run_until_complete(self.setup())
self._wait_for_loop()
self.loop.run_until_complete(self.setup())

def find_player_sync(self):
wait_for_loop()
loop.run_until_complete(self.find_player())
self._wait_for_loop()
self.loop.run_until_complete(self.find_player())

def play(self):
if not self.player_interface:
return
wait_for_loop()
loop.run_until_complete(self.player_interface.call_play())
self._wait_for_loop()
self.loop.run_until_complete(self.player_interface.call_play())

def pause(self):
if not self.player_interface:
return
wait_for_loop()
loop.run_until_complete(self.player_interface.call_pause())
self._wait_for_loop()
self.loop.run_until_complete(self.player_interface.call_pause())

def stop(self):
if not self.player_interface:
return
wait_for_loop()
loop.run_until_complete(self.player_interface.call_stop())
self._wait_for_loop()
self.loop.run_until_complete(self.player_interface.call_stop())

def next(self):
if not self.player_interface:
return
wait_for_loop()
loop.run_until_complete(self.player_interface.call_next())
self._wait_for_loop()
self.loop.run_until_complete(self.player_interface.call_next())

def previous(self):
if not self.player_interface:
return
wait_for_loop()
loop.run_until_complete(self.player_interface.call_previous())
self._wait_for_loop()
self.loop.run_until_complete(self.player_interface.call_previous())

def set_shuffle(self, enabled: bool) -> None:
if not self.player_interface:
return
wait_for_loop()
self._wait_for_loop()
self.shuffle = 'alltracks' if enabled else 'off'
loop.run_until_complete(self.player_interface.set_shuffle(self.shuffle))
self.loop.run_until_complete(self.player_interface.set_shuffle(self.shuffle))

def set_repeat(self, enabled: bool) -> None:
if not self.player_interface:
return
wait_for_loop()
self._wait_for_loop()
self.repeat = 'alltracks' if enabled else 'off'
loop.run_until_complete(self.player_interface.set_repeat(self.repeat))
self.loop.run_until_complete(self.player_interface.set_repeat(self.repeat))

def get_codec_str(self) -> str:
if not self.codec:
Expand Down
26 changes: 14 additions & 12 deletions python/linamp/btplayer/btplayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ def __init__(self) -> None:

self.clear_message()

self.player.setup_sync()

def _display_connection_info(self):
if self.player.connected:
self.message = f'CONNNECTED TO: {self.player.device_alias}'
Expand Down Expand Up @@ -84,7 +82,7 @@ def prev(self) -> None:

# Go to a specific time in a track while playing
def seek(self, ms: int) -> None:
self.message = "NOT SUPPORTED"
self.message = 'NOT SUPPORTED'
self.show_message = True
self.message_timeout = 3000

Expand All @@ -95,7 +93,7 @@ def set_repeat(self, enabled: bool) -> None:
self.player.set_repeat(enabled)

def eject(self) -> None:
self.message = "NOT SUPPORTED"
self.message = 'NOT SUPPORTED'
self.show_message = True
self.message_timeout = 3000

Expand All @@ -105,26 +103,26 @@ def get_postition(self) -> int:
return self.player.position

def get_shuffle(self) -> bool:
return self.player.shuffle != "off"
return self.player.shuffle != 'off'

def get_repeat(self) -> bool:
return self.player.repeat != "off"
return self.player.repeat != 'off'

# Returns the str representation of PlayerStatus enum
def get_status(self) -> str:
status = PlayerStatus.Idle
btstatus = self.player.status
if btstatus == "playing":
if btstatus == 'playing':
status = PlayerStatus.Playing
if btstatus == "stopped":
if btstatus == 'stopped':
status = PlayerStatus.Stopped
if btstatus == "paused":
if btstatus == 'paused':
status = PlayerStatus.Paused
if btstatus == "error":
if btstatus == 'error':
status = PlayerStatus.Error
if btstatus == "forward-seek":
if btstatus == 'forward-seek':
status = PlayerStatus.Loading
if btstatus == "reverse-seek":
if btstatus == 'reverse-seek':
status = PlayerStatus.Loading
return status.value

Expand All @@ -148,3 +146,7 @@ def poll_events(self) -> bool:

# Should tell UI to refresh if we are connected and were not connected before
return self.player.connected and not was_connected

# This will be run in a new thread when linamp starts
def run_loop(self):
self.player.setup_sync()
5 changes: 4 additions & 1 deletion python/linamp/cdplayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,10 @@ def detect_disc_insertion(self):
return False
d.close()
except Exception as e:
print(f"Problem finding a CD-ROM. {e}")
if self._detect_disc_insertion_is_first_call:
# Only print this once to avoid polluting the logs
print(f"Problem finding a CD-ROM. {e}")
self._detect_disc_insertion_is_first_call = False

return False

Expand Down
1 change: 1 addition & 0 deletions python/linamp/spotifyplayer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from linamp.spotifyplayer.spotifyplayer import *
Loading