Add sound player in table or pandas - streamlit

result = st.file_uploader("Upload", type=["wav", "ogg", "mp3", "mp4"], accept_multiple_files=True)
I need to display table with audio player in each row, something like this:
]
Does anyone have a solution?

Related

How to convert div tags to a table?

I want to extract the table from this website https://www.rankingthebrands.com/The-Brand-Rankings.aspx?rankingID=37&year=214
Checking the source of that website, I noticed that somehow the table tag is missing. I assume that this table is a summary of multiple div classes. Is there any easy approach to convert this table to excel/csv? I badly have coding skills/experience...
Appreciate any help
There are a few way to do that. One of which (in python) is (pretty self-explanatory, I believe):
import lxml.html as lh
import csv
import requests
url = 'https://www.rankingthebrands.com/The-Brand-Rankings.aspx?rankingID=37&year=214'
req = requests.get(url)
doc = lh.fromstring(req.text)
headers = ['Position', 'Name', 'Brand Value', 'Last']
with open('brands.csv', 'a', newline='') as fp:
#note the 'a' in there - for 'append`
file = csv.writer(fp)
file.writerow(headers)
#with the headers out of the way, the heavier xpath lifting begins:
for row in doc.xpath('//div[#class="top100row"]'):
pos = row.xpath('./div[#class="pos"]//text()')[0]
name = row.xpath('.//div[#class="name"]//text()')[0]
brand_val = row.xpath('.//div[#class="weighted"]//text()')[0]
last = row.xpath('.//div[#class="lastyear"]//text()')[0]
file.writerow([pos,name,brand_val,last])
The resulting file should be at least close to what you're looking for.

Building a query in appmaker with "or"

So say I am using a form to build a query against my datasource (i've come so far in two weeks! I can do this!), how do I make it more complex?
What if I want books by austen that include the word "pride" AND books by gabaldon that contain the word "Snow"
the individual queries would be
widget.datasource.query.filters['author']._contains = "austen";
widget.datasource.query.filters['title']._contains = "pride";
and
widget.datasource.query.filters['author']._contains = "gabaldon";
widget.datasource.query.filters['title']._contains = "snow";
in pseudosql it would be
select * from table
where
((author like 'austen') and (title like 'snow'))
or
((author like 'gabaldon') and (title like 'pride'))
Is there a way to filter a data source on a complex query like this and cut out the whole widget.datasource aspect? I'd be fine with using a calculated table.
Edit: Ok i'm making some progress towards the kind of functionality I need, can anyone tell me why this works:
widget.datasource.query.filters.document_name._contains = 'x';
but this does not?
widget.datasource.query.parameters.v1 = "x";
widget.datasource.query.where = 'document_name contains :v1';
this also doesn't work:
widget.datasource.query.where = 'document_name contains "x"';

Show table by button click

TABLES: mara, marc.
"marc is N
"mara is 1
SELECTION-SCREEN PUSHBUTTON 15(10) text-001 USER-COMMAND press.
DATA: lt_mara TYPE TABLE OF mara WITH HEADER LINE,
ls_mara TYPE mara.
DATA: lt_marc TYPE TABLE OF marc WITH HEADER LINE,
ls_marc TYPE marc,
Sum type P length 8 DECIMALS 2.
PARAMETERS: p_mtart TYPE mara-mtart.
SELECT-OPTIONS: so_werks FOR marc-werks.
SELECT * FROM mara INTO TABLE lt_mara
WHERE mtart = p_mtart.
IF sy-subrc = 0.
SELECT * FROM marc INTO TABLE lt_marc
FOR ALL ENTRIES IN lt_mara
WHERE matnr = lt_mara-matnr
AND werks IN so_werks.
LOOP AT lt_marc INTO ls_marc.
READ TABLE lt_mara INTO ls_mara
WITH KEY matnr = ls_marc-matnr.
sum = ls_mara-brgew + ls_mara-ntgew .
WRITE:/ ls_mara-mtart, ls_marc-matnr , ls_marc-werks , ls_mara-brgew, ls_mara-ntgew,sum.
ENDLOOP.
ELSE.
MESSAGE TEXT-e02 TYPE 'E' .
ENDIF.
How Can make this happen:I want that on click of the button to show the table.Please the code to be as simple as possible and as easy to understand as possible.if you can't make it with a button make it with a radiobutton or smth else.
Thanks in advance!
If you want to keep it simple, you can use "sy-ucomm" which stores your last triggered action. With your button, it'd look like this:
AT SELECTION-SCREEN.
CASE sy-ucomm.
WHEN 'PRESS'.
*code for displaying your table via ALV or WRITE goes here*
ENDCASE.
The most common way to display internal tables like this is with an ALV, a simple example of how to build up an ALV can be found here:
https://archive.sap.com/discussions/thread/873601
If you'd like it to do the WRITE: to screen under one circumstance, and display the ALV Grid in another, you should use Select Options and parameters.
Your code needs the addition of EVENTS, please take a look here on what they are and how to use them:
http://www.erpworkbench.com/abap/abap-events.htm

How to add a window in wxpython other then parent frame and use information in sqlite query

I have a button in my parent frame(named as Add). I want to open a TextEntryDialog when user clicks that button,I want to open it like a pop up window.And i have to send that text typed by user back to parent frame, which i am going insert into my database table. It would be better if i can make a editable listctrl, in which i will have 4 columns and user will fill information into those columns and by sqlite query i will fill that information into database table.So how can i accomplish this?
First tutorial on the first page of a search for "wxpython text dialog"
https://pythonspot.com/en/wxpython-input-dialog/
You don't appear to have put in any effort whatsoever!
#!/usr/bin/python
import wx
def onButton(event):
print "Button pressed."
app = wx.App()
frame = wx.Frame(None, -1, 'win.py')
frame.SetDimensions(0,0,200,50)
# Create text input
dlg = wx.TextEntryDialog(frame, 'Enter some text','Text Entry')
dlg.SetValue("Default")
if dlg.ShowModal() == wx.ID_OK:
print('You entered: %s\n' % dlg.GetValue())
dlg.Destroy()

GRID COLUMNS atk4 agiletoolkit

Hi I am trying to get some referenced data from another table,
Data structure:
Table PartDetail
-id
-OperationTypeID(foreign key)
-DateAdded
Table OperationType
-id
-Description
I am trying something like this:
$crud = $this->add('MVCGrid', array('allow_edit'=>false));
$crud->setModel('Model_PartDetail',array('DateAdded'));
But then I want to see the "description" from table OperationType, because on my PartDetail model I declare my relationship like this:
$this->hasOne('OperationType','OperationTypeID','Description')
->mandatory(true)
->caption('Operation Type');
for example in this case I want to see the description from the table OperationType
I tried:
$crud->setModel('Model_PartDetail',array('DateAdded','OperationType'));
but is not working, only works with:
$crud->setModel('Model_PartDetail',array('DateAdded','OperationTypeID'));
but I get only the ID number, not the description.
How this works?
I was able to solved it.
on the model you need to redefine it as
$ref = $this->add('Field_Reference', 'OperationTypeID');
$ref->dereferenced_field='OperationTypeDescription';
$m = $this->add('Model_OperationType');
$m->addField('D'); // <-- actually seems that this line is not working
$ref->setModel($m, 'Description');
And then in the page you can actually added as OperationTypeDescription:
$crud->setModel('Model_PartDetail', array('DateAdded', 'OperationTypeDescription'));

Resources